QualitySoup
New Member
- Joined
- Jul 14, 2022
- Messages
- 19
- Office Version
- 365
- Platform
- Windows
Hi, Everyone!
I'm trying to find a way to have values copy to the first empty row on a separate sheet. Below is the code that I am working with from @My Aswer Is This.
All I need is for excel to find the first empty row from top to bottom and "paste" it there.
I'm trying to find a way to have values copy to the first empty row on a separate sheet. Below is the code that I am working with from @My Aswer Is This.
All I need is for excel to find the first empty row from top to bottom and "paste" it there.
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified 7/15/2022 12:41:36 AM EDT
If Target.Column = 1 Then
On Error GoTo M
Dim r As Long
Dim ans As String
ans = Target.Value
r = Target.Row
Dim Lastrow As Long
Lastrow = Sheets(ans).Cells(Rows.Count, "A").End(xlUp).Row + 1
Rows(r).Copy Sheets(ans).Rows(Lastrow)
Rows(r).ClearContents
End If
Exit Sub
M:
MsgBox "You double clicked on " & ans & vbNewLine & "This sheet does not exist"
End Sub