Malcolm torishi
Board Regular
- Joined
- Apr 26, 2013
- Messages
- 219
Hi can someone help please
I have the following VBA code which is in my worksheet 3 known as “IN” and what this code does is basically cuts and pastes the cell content under column A from my “IN” sheet and pastes it into column C in my “OUT “sheet, but because the “OUT” sheet 4 has a “ - “ sign already under column C what I want the code to do is clear the “ – “ sign first and then continue with the below code. ie paste the cell content under column C in my “OUT” sheet and not have any “-“ signs.
So as this code stands at the minute it pastes the names under “ – “ signs so I can have 3 or 4 “-“ signs and then a name rather than just having names stacked under one another under column C and no “-“ signs.
thanks
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified 6/18/2019 3:09 PM EDT
If Target.Column = 4 And Target.Row > 1 Then
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets(4).Cells(Rows.Count, "C").End(xlUp).Row + 1
Target.Offset(, -3).Resize(, 1).Copy Sheets(4).Cells(Lastrow, 3)
Target.Offset(, -3).Resize(, 3).ClearContents
End If
End Sub
I have the following VBA code which is in my worksheet 3 known as “IN” and what this code does is basically cuts and pastes the cell content under column A from my “IN” sheet and pastes it into column C in my “OUT “sheet, but because the “OUT” sheet 4 has a “ - “ sign already under column C what I want the code to do is clear the “ – “ sign first and then continue with the below code. ie paste the cell content under column C in my “OUT” sheet and not have any “-“ signs.
So as this code stands at the minute it pastes the names under “ – “ signs so I can have 3 or 4 “-“ signs and then a name rather than just having names stacked under one another under column C and no “-“ signs.
thanks
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified 6/18/2019 3:09 PM EDT
If Target.Column = 4 And Target.Row > 1 Then
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets(4).Cells(Rows.Count, "C").End(xlUp).Row + 1
Target.Offset(, -3).Resize(, 1).Copy Sheets(4).Cells(Lastrow, 3)
Target.Offset(, -3).Resize(, 3).ClearContents
End If
End Sub