Hi,
I have a code to copy and paste values till first empty row but then I want vba to copy and paste values after that till it find second empty row. So For first I did
and for the second I did
For first one it works but for second one it is not finding the empty row after and instead putting the "Lastrow2" value same as "Nextrow". Can someone help me with that. Thanks
I have a code to copy and paste values till first empty row but then I want vba to copy and paste values after that till it find second empty row. So For first I did
Code:
Lastrow = Cells.Find(What:="*", After:=[A20], SearchOrder:=xlByRows).Row
Range("A1:H" & Lastrow - 1).Offset(19, 0).Copy
ws2.Activate
Range("A22").Insert Shift:=xlDown
and for the second I did
Code:
Nextrow = 21 + Lastrow
Lastrow2 = Cells.Find(What:="*", After:=ws1.Cells(Nextrow, 1), SearchOrder:=xlByRows).Row
Range("A1:H" & Lastrow2 - 1).Offset(Nextrow, 0).Copy
ws2.Activate
Range("A" & Nextrow).Insert Shift:=xlDown
For first one it works but for second one it is not finding the empty row after and instead putting the "Lastrow2" value same as "Nextrow". Can someone help me with that. Thanks