Okay so I have two rows of yes/no cells and I would like to run a specific macro based on which cell was double clicked(yes/no)
Problem is, the code I found runs no matter where I double click
Heres the code I have:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Call MyMacro
End Sub
This macro should only run for one specific sheet, as other sheets will have macros like this on running(same setup of sheets for different info)
Yes |
No |
Info 1 |
Yes |
No |
Info 2 |
Yes |
No |
Info 3 |
How can I define my function so that it only run when I double click in a specific range.
FYI: My macro is relative so it will change based on which box I click
=-=-==-==-=-=-=-=-=--==-=--==--=-=-==--==-=--==-
Edit:
I figured it out!
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 1 Then
Call macro1
ElseIf Target.Column = 2 Then
Call macro2
End If
End Sub
make sure to put it in the sheet and not the module window!
Bookmarks