Thursday, September 13, 2012

Macro To Combine or Merge or Consolidate Desired or Specific Sheets In One Sheet

Macro to Combine or Merge or Consolidate Specific desired Sheets In One Sheet
Sub ConsolDesireSheets()
Dim x As Integer
Dim y As Integer
Dim a As Worksheet
Dim b As Integer

b = 1 'Increment Variable

For Each a In Worksheets(Array("Sheet1", "Sheet3", "Sheet5"))
'Only Sheets defined in an Array are Consolidated in a given order following each
a.Activate
For x = 2 To 100 'Rows having the Data’
b = b + 1 'Data begins from 2 Row in a Consolidated Sheet’

For y = 1 To 6 'Columns having the Data’
Sheets ("MAIN").Cells (b, y) = a.Cells(x, y)
Next y

If Cells(x, 1) = "" Then Exit For
Next x
'b = b - 2  'Joins each Sheet data together, else each Sheet data is separated by a Single empty Row.
Next a
End Sub

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.