E
Eric
Good morning everyone,
I am using the macro below and if every cell has information in it, the
macro works great. But, if a cell is empty the macro will work up to the
empty cell and go no further leaving empty spaces on the other sheet. Is
there a way to make it copy the blank cells and continue with all the other
cells?
Here is the macro:
Sub Last_four()
Sheets("Last Four").Select
Dim lastrow As Long
Dim myrow As Long
Dim mycol As Long
lastrow = Sheets("test database").Cells(Rows.count, "A").End(xlUp).Row
myrow = 1
mycol = 1
For i = 12 To 9 Step -1
Do Until Sheets("test database").Cells(lastrow, mycol) = ""
Sheets("last four").Cells(i, mycol) = Sheets("test database").Cells(lastrow,
mycol)
mycol = mycol + 1
Loop
lastrow = lastrow - 1
mycol = 1
Next
End Sub
Example:
column 1 2 3 4 5
a b c d e ~~~>
this works
Example:
column 1 2 3 4 5
a c d e ~~~>
this does not work
Any help would be appreciated....Thank you in advance....
Eric
I am using the macro below and if every cell has information in it, the
macro works great. But, if a cell is empty the macro will work up to the
empty cell and go no further leaving empty spaces on the other sheet. Is
there a way to make it copy the blank cells and continue with all the other
cells?
Here is the macro:
Sub Last_four()
Sheets("Last Four").Select
Dim lastrow As Long
Dim myrow As Long
Dim mycol As Long
lastrow = Sheets("test database").Cells(Rows.count, "A").End(xlUp).Row
myrow = 1
mycol = 1
For i = 12 To 9 Step -1
Do Until Sheets("test database").Cells(lastrow, mycol) = ""
Sheets("last four").Cells(i, mycol) = Sheets("test database").Cells(lastrow,
mycol)
mycol = mycol + 1
Loop
lastrow = lastrow - 1
mycol = 1
Next
End Sub
Example:
column 1 2 3 4 5
a b c d e ~~~>
this works
Example:
column 1 2 3 4 5
a c d e ~~~>
this does not work
Any help would be appreciated....Thank you in advance....
Eric