Dim ws(), i As Long, r As Long, s As Long
ws = Array("Sheet1", "Sheet2")
s = 1
For i = LBound(ws) To UBound(ws)
r = 1
Do While Sheets(ws(i)).Cells(r, 1) > 0 ' this is the line checking for blanks
Sheets("Sheet3").Cells(s, 1) = Sheets(ws(i)).Cells(r, 1)
' the first half of the line above is the destination cell, the second
' half is the source cell.
s = s + 1
r = r + 1
Loop
Next i
Hope this helps, StephenR's using cells(1, 1) format instead of range("a1") format. The first number is the row reference, so cells(2, 1) would be row 2, column A, and so on, cells(5, 6) would be row 5, column F. I believe the following adaptation will fit your requests, although I haven't tested it ><
Dim ws(), i As Long, r As Long, s As Long
ws = Array("Sheet1", "Sheet2")
s = 1
For i = LBound(ws) To UBound(ws)
r = 1
Do While Sheets(ws(i)).Cells(r + 2, 3) > 0 ' this is the line checking for blanks
Sheets("Sheet3").Cells(s + 3, 2) = Sheets(ws(i)).Cells(r + 2, 3)
' the first half of the line above is the destination cell, the second
' half is the source cell.
s = s + 1
r = r + 1
Loop
Next i
You could just change the constant at the beginning of the declarations, S = 4, R = 3. But I figured for the sake of explanation I'd do it in the formula so you can see what does what.
Bookmarks