Find second empty cell/row and start pasting from it

Closed
scafy Posts 1 Registration date Wednesday 17 September 2014 Status Member Last seen 17 September 2014 - 17 Sep 2014 à 22:23
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 23 Sep 2014 à 11:32
I've already did a lot of research and couldn't find a solution. I'm trying to find the second empty cell/row (or other especified cell) in a column and start pasting from it (always jumping to next empty cell/row). I found the code below, but it starts pasting from the first empty row in a column. Changing the offset command to (2,0) doesn't work too because it finds the second empty row but starts pasting always leaving a empty cell between the collages. And I want to find the second empty cell only in the beginning and from there start pasting always in the next first empty cell/row. Can you guys help me please? Thanks a lot in advance!

For example, I'm copying the range G4:I4 and trying to paste into column G.

Code:

Sub InsertButton()
Range("G4:I4").Copy Range("G" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
Related:

1 response

TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 555
23 Sep 2014 à 11:32
Hi Scafy,

Well you could just use two codes, but you can also try this:
Dim Check As Boolean
Sub InsertButton()

If Check = False Then
    Range("G4:I4").Copy Range("G" & Rows.Count).End(xlUp).Offset(2, 0)
    Check = True
Else
    Range("G4:I4").Copy Range("G" & Rows.Count).End(xlUp).Offset(1, 0)
End If

End Sub


Best regards,
Trowa