Showing posts with label Excel. Show all posts
Showing posts with label Excel. Show all posts

Monday, May 27, 2013

Summerizing all worksheet columns into first worksheet

Sub Macro1()
Dim ws As Worksheet
Dim wsInfo As Worksheet
Set wsInfo = ActiveWorkbook.Sheets(1)
Dim Counter As Integer
Counter = 1
For Each ws In ActiveWorkbook.Sheets
Dim columnCounter As Integer
Dim wsColumnCounter As Integer
columnCounter = 2
wsInfo.Cells(Counter, "A").Value = ws.Name

wsColumnCounter = 1
Do While ws.Cells(1, i) <> ""
wsInfo.Cells(Counter, columnCounter).Value = ws.Cells(1, wsColumnCounter)
columnCounter = columnCounter + 1
wsColumnCounter = wsColumnCounter + 1
Loop

Counter = Counter + 1
Next
End Sub


"This code is not tested"

Wednesday, May 19, 2010

Summerizing all worksheet columns into first worksheet


Sub Macro1()


Dim ws As Worksheet
Dim wsInfo As Worksheet
Set wsInfo = ActiveWorkbook.Sheets(1)
Dim Counter As Integer
Counter = 1
For Each ws In ActiveWorkbook.Sheets

Dim columnCounter As Integer
Dim wsColumnCounter As Integer
columnCounter = 2
wsInfo.Cells(Counter, "A").Value = ws.Name
wsColumnCounter = 1
Do While ws.Cells(1, i) <> ""

wsInfo.Cells(Counter, columnCounter).Value = ws.Cells(1, wsColumnCounter)
columnCounter = columnCounter + 1
wsColumnCounter = wsColumnCounter + 1

Loop
Counter = Counter + 1

Next

End Sub