mrstarfire
New Member
- Joined
- Apr 16, 2018
- Messages
- 2
Hi, using excel I need to be able to run different macros when different cells are selected (clicked) in a worksheet.
For example.
cell e1 run macro save
cell f1 run macro print this page
cell B4 run the macro update 4
cell b5 run the macro update 5
cell d9 run the macro update 15
I have tried using this code in the worksheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("e1")) Is Nothing Then
save
End If
End If
End Sub
which allows me to save the spreadsheet but it wont allow me to run any other macros.
I tried adding this as well
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("b4")) Is Nothing Then
update4
End If
End If
End Sub
When I try i get this error message.
Compile error
Ambiguous name detected: Worksheet_SelectionChange
For example.
cell e1 run macro save
cell f1 run macro print this page
cell B4 run the macro update 4
cell b5 run the macro update 5
cell d9 run the macro update 15
I have tried using this code in the worksheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("e1")) Is Nothing Then
save
End If
End If
End Sub
which allows me to save the spreadsheet but it wont allow me to run any other macros.
I tried adding this as well
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("b4")) Is Nothing Then
update4
End If
End If
End Sub
When I try i get this error message.
Compile error
Ambiguous name detected: Worksheet_SelectionChange