Expected behavior:
When naming the first cell in a row and double clicking it, the row is copied, deletes and removes itself from the sheet and is then placed on another sheet with the same name as entered. Rows on 2nd sheet should not overwrite.
Ask:
I found the code below written by My Answer Is which does everything but remove the row where the rest of the rows shift up to fill the gap. I've enclosed the script below. Any help is really appreciated. Thanks in advance.
Code:
When naming the first cell in a row and double clicking it, the row is copied, deletes and removes itself from the sheet and is then placed on another sheet with the same name as entered. Rows on 2nd sheet should not overwrite.
Ask:
I found the code below written by My Answer Is which does everything but remove the row where the rest of the rows shift up to fill the gap. I've enclosed the script below. Any help is really appreciated. Thanks in advance.
Code:
VBA Code:
Expected behavior: When doing something like double click a cell, move a row to another sheet
In searching, I found the code below from And The
In reviewing[ICODE]
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
[/ICODE]