I am very new to vba but I am stuck trying to get a subtraction when a cell is entered.
For example I want in column A to do =B10-G10 but I want this on any row not specific to row 10
This is mainly to count how many days between 2 dates but it will change based on when Column G or B is changed.
I have the below but it doesn't work.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
If Target.Column = 1 Then
Cells(Target.Row, 2) - Cells(Target.Row, 6))
End If
End If
End Sub
For example I want in column A to do =B10-G10 but I want this on any row not specific to row 10
This is mainly to count how many days between 2 dates but it will change based on when Column G or B is changed.
I have the below but it doesn't work.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
If Target.Column = 1 Then
Cells(Target.Row, 2) - Cells(Target.Row, 6))
End If
End If
End Sub