Takes2ToTango
Board Regular
- Joined
- May 23, 2023
- Messages
- 69
- Office Version
- 365
- Platform
- Windows
Hi All, Running into a problem. The below code doesn't properly run. Once it gets to 'Worksheets("Revision").Range("G16") = ActiveCell it seems to run over itself. Sometimes the range won't be inputted with active cell and 9 out of 10 times the row will not be deleted and will remain. Any help would be appreciated.
VBA Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("A:A")) Is Nothing Then Cancel = True
If MsgBox("Do you want to remove the flag for this part?", vbYesNo) = vbYes Then
Cells(ActiveCell.Row, 1).Interior.ColorIndex = 0
Cells(ActiveCell.Row, 2).Interior.ColorIndex = 0
Cells(ActiveCell.Row, 3).Interior.ColorIndex = 0
Cells(ActiveCell.Row, 6).Interior.ColorIndex = 0
Cells(ActiveCell.Row, 7).Interior.ColorIndex = 0
Cells(ActiveCell.Row, 8).Interior.ColorIndex = 0
Cells(ActiveCell.Row, 9).Interior.ColorIndex = 0
Worksheets("Revision").Range("G16") = ActiveCell
Application.Wait (Now + TimeValue("00:00:02"))
call DeleteRow
End Sub
Sub DeleteRow
Dim k As Integer
If Worksheets("Revision").Range("G16") = "" Then
Exit Sub
Else
For k = 30 To 1 Step -1
If Cells(k, 3).Value = Worksheets("Revision").Range("G16") Then
Cells(k, 3).EntireRow.Delete
End If
Next k
End If
End If
End Sub
Last edited: