Malcolm torishi
Board Regular
- Joined
- Apr 26, 2013
- Messages
- 219
Hi can anyone please help I have the following VBA Code that works great but what I know would like to do is rather than the code copy the first 4 cells on a row when I double click, let’s say cells A1-A4, can the code not touch and leave cell A3 alone . So even if I was to modify the code below to copy more cells say A1-A10 it would always leave Cell A3 alone
thank anyone you can help
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified 6/18/2019 2:29:06 PM EDT
If Target.Column = 5 And Target.Row > 1 Then
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1
Target.Offset(, -4).Resize(, 4).Copy Sheets(2).Cells(Lastrow, 1)
End If
End Sub
thank anyone you can help
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified 6/18/2019 2:29:06 PM EDT
If Target.Column = 5 And Target.Row > 1 Then
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1
Target.Offset(, -4).Resize(, 4).Copy Sheets(2).Cells(Lastrow, 1)
End If
End Sub