Merged cells will not activate Worksheet_SelectionChange Macro

Bill_Biggs

Well-known Member
Joined
Feb 6, 2007
Messages
1,216
I have merged three cells together to make one large activation cell. The Range is B15:D15. I have tried three ways to set up my Worksheet_SelectionChange macro to activate when it is clicked:

Code:
    If Not Application.Intersect(Range("B15,C15,D15"), Target) Is Nothing Then
    Macro18 'Create Data Fields
 
    If Not Application.Intersect(Range("B15:D15"), Target) Is Nothing Then
    Macro18 'Create Data Fields
 
    If Not Application.Intersect(Range("B15"), Target) Is Nothing Then
    Macro18 'Create Data Fields

None of these will do it. However, the third one works if I umnerge the cells. Is there a way to make this work and keep the cells merged?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
This worked for me in Excel 2000:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Application.Intersect(Range("B15:D15"), Target) Is Nothing Then
        MsgBox "Hello"
    End If
End Sub

Are you sure events are enabled?
 
Upvote 0
Code:
If Not Application.Intersect(Range("B15:D15"), Target) Is Nothing Then
worked for me with B15:D15 merged.

Have you considered using Horizontal Alignment : CenterAcrossSelection rather than merged cells? Merged cells will cause other problems.
 
Upvote 0
Yeah, and all the other cells that have to activate the macro work, but this one, when the cells are merged, does not. I am in 2007. Could there be a difference? It seems unlikely. I'll give it a go Mick. Long time no see!
 
Upvote 0

Forum statistics

Threads
1,215,329
Messages
6,124,301
Members
449,149
Latest member
mwdbActuary

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