I've got a code to work for only cells D3 and E3, I need it to do the same for other cells like D4/E4, D5/E5 but with different formulae on the same worksheet. I'm trying to make new private subs for the other cells but they do not seem to compile? Thanks in advance:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim DE As Range, t As Range, v As Variant
Dim r As Long
Set t = Target
Set DE = Range("D3:E3")
If Intersect(t, DE) Is Nothing Then Exit Sub
Application.EnableEvents = False
r = t.Row
v = t.Value
If v = "" Then
Range("D" & r & ":E" & r).Value = ""
End If
If IsNumeric(v) Then
If Intersect(t, Range("E3:E3")) Is Nothing Then
t.Offset(0, 1).Value = v * 0.0393701
Else
t.Offset(0, -1).Value = v / 0.0393701
End If
End If
Application.EnableEvents = True
End Sub
Range("D3" & r & ":E3" & r).Value = ""correct? Shouldn't it beRange("D" & r & ":E" & r).Value = ""? – Dec 04 '19 at 11:07