Tuesday, September 25, 2012

Excel VBA Macro To Concatenate each Sheet Data In Main Sheet

Excel VBA Macro To Concatenate each Sheet Data In Main Sheet
Sub ConcateSheets()
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

Dim W As Worksheet
Dim A As Integer

A = 0 'Variable for Column Increment In Main Sheet

For Each W In Worksheets
If W.Name <> Sheets("MAIN").Name Then
W.Activate

For X = 1 To 10
If Cells(X, 1) <> "" Then

Z = Z + 1 'Row Increment Variable

For Y = 1 To 26
Sheets("MAIN").Cells(Z, A + Y) = W.Cells(X, Y)
If Cells(1, Y) = "" Then Exit For
Next Y

End If
Next X

A = A + Y - 1 'Variable for Columns Join In Main Sheet

End If
Z = 0
Next W
End Sub

Note:
Each Column of Each Sheet Comes Side By Side(Concatenation Mode) in Main Sheet.

Thanks,Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog