Hi All,
So I have this code to multiply entries made in J9:L9 by the value in the same column cell 4.
I want to change this so that entires would instead multiply by whatever is in column K, but keeping a relative cell reference, for example:
Enter a value in J9 and the result will be J9*K9
Enter a value in J9 and the result will be J10*K10
Enter a value in J9 and the result will be L9*K9
Enter a value in J9 and the result will be L10*K10
A great bonus to have would be a message box that would run asking the user to fill column K first, if they try to enter a value in the range J9:L38, but K is empty.
Thank you in advance!
So I have this code to multiply entries made in J9:L9 by the value in the same column cell 4.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Application.Intersect(Target, Range("J9:L38")) Is Nothing Then Exit Sub
If Target.CountLarge <> 1 Then Exit Sub
On Error GoTo catch
Application.EnableEvents = False
Target.Value = Target.Value * Cells(4, Target.Column)
catch:
Application.EnableEvents = True
End Sub
I want to change this so that entires would instead multiply by whatever is in column K, but keeping a relative cell reference, for example:
Enter a value in J9 and the result will be J9*K9
Enter a value in J9 and the result will be J10*K10
Enter a value in J9 and the result will be L9*K9
Enter a value in J9 and the result will be L10*K10
A great bonus to have would be a message box that would run asking the user to fill column K first, if they try to enter a value in the range J9:L38, but K is empty.
Thank you in advance!