I am very new to VBA and have the following problem;
I have a worksheet with 10 columns and 90 rows, I would like to sum 2 cells in the same row then compare the result to a 3rd cell in the same row, If the sum of the 2 cells is greater then the 3rd cell I would like to display a Message box.
We can call cells 1 & 2 column b and f and cell 3 column d
The other If statement shown is for another function not completed yet, so it needs to stay.
I have already started the framework in the VBA editor see below.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Range("H1").Value = Date
Application.EnableEvents = True
If Target.Column > 5 And Target.Column < 7 Then
MsgBox "enter text here"
Else
If Target.Column > 7 And Target.Column < 9 Then
MsgBox "enter text here"
Exit Sub
End If
End If
End Sub
Thanks,
Bruce
I have a worksheet with 10 columns and 90 rows, I would like to sum 2 cells in the same row then compare the result to a 3rd cell in the same row, If the sum of the 2 cells is greater then the 3rd cell I would like to display a Message box.
We can call cells 1 & 2 column b and f and cell 3 column d
The other If statement shown is for another function not completed yet, so it needs to stay.
I have already started the framework in the VBA editor see below.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Range("H1").Value = Date
Application.EnableEvents = True
If Target.Column > 5 And Target.Column < 7 Then
MsgBox "enter text here"
Else
If Target.Column > 7 And Target.Column < 9 Then
MsgBox "enter text here"
Exit Sub
End If
End If
End Sub
Thanks,
Bruce
Last edited: