if intersect else intersect

hwkeyser

Board Regular
Joined
Jun 7, 2011
Messages
116
Hi all,

I'm looking for help on a "Worksheet_SelectionChange(byVal Target As Range)"

What i think i want to do is something along the lines of

If intersect "G30,P30" then
Module4.opencalendar

Else if interesct "Z30,AI30" Then
Module5.opentime


Now naturally that doesn't work but it's something like that. 4 cells on same worksheet producing 2 different userforms.

I'm completely open to suggestions and ideas. i already have the .opencalendar working by itself as:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("G30,P30")) Is Nothing Then
        Module4.OpenCalendar
    End If
End Sub

Help! Thanks,

HK
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
One way:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Select Case Target.Address(False, False)
        Case "G30", "P30"
            OpenCalendar
        Case "Z30", "AI30"
            OpenTime
    End Select
End Sub
 
Upvote 0
When I dropped that code in, it doesn't appear to do anything on the worksheet, and when i try to run it from the worksheet code, it prompts me which macro to run. I've been here before so it tries to apply one macro to both and neither for the other
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,875
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top