Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
The code below runs when any cell in column H row 12 downwards is double-clicked
I'm looking for an additional row of code so the above code does not run if Column B in the same row contains the word 'OTHER' (without the commas).
Many thanks!
The code below runs when any cell in column H row 12 downwards is double-clicked
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
' check Target is in column H
If Target.Column = 8 And Target.Row >= 12 Then
Cancel = True
TopCell = Cells(12, 3).Address 'Row 12, Column 3 i.e. mileage
BottomCell = Cells(Target.Row, 3).Address
TotalCalc = Application.WorksheetFunction.Sum(Range(TopCell, BottomCell))
MsgBox "Total miles run to " & Format(Cells(ActiveCell.Row, 1), "dd mmmm yyyy: ") & _
Format((CLng(10720.31 + TotalCalc)), "#,##0") & " ", vbOKOnly, "Lifetime Mileage"
End If
I'm looking for an additional row of code so the above code does not run if Column B in the same row contains the word 'OTHER' (without the commas).
Many thanks!