Tuesday, 25 September 2012

How To Import First Sheet Data into First Column of Main Sheet , Second Sheet Data In Second Column of Main Sheet and so on......

Excel VBA Macro To Merge First Sheet Data into First Column of  Main Sheet , Second Sheet Data In Second Column of Main Sheet and so on......

Sub ConsolNconcMulCol()
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

Dim W As Worksheet
Dim A As Integer
Dim B As Integer

A = 1 'Variable for Column Increment In Main Sheet

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

For Y = 1 To 26
For X = 1 To 100

If Cells(X, Y) <> "" Then
Z = Z + 1 'Row Increment Variable
Sheets("MAIN").Cells(Z, A) = W.Cells(X, Y)
End If

Next X
Next Y

A = A + 1 'Variable for Column Increment In Main Sheet
End If

Z = 0

Next W

End Sub

No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts