Saturday, 8 September 2018

Excel, how to run multiple macros for individual cells in a worksheet?

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

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...