Making a pop-up form work from a merged cell

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
85
Hi,

I've used the following code in another workbook to open a calander pop up when I choose a particular cell and then once i've selected the date I want to select another cell.

I'm trying to use the same code on another workbook however the cell I want to use to start the pop up is merged with a few others, H2-J2.

What do I have to do to the code to select the merged cells?

Thanks in advance

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If (Target.CountLarge = 1) Then
    If Not Intersect(Target, Range("H2")) Is Nothing Then
    frmCalendar.Show
    Range("A2").Select
    End If
    End If
End Sub
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
2,961
.
Your code seems to work if you merge only TWO CELLS (H2 & I2). Would that still allow your sheet to
display how you wanted ?
 

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
85
No unfortunately it would give enough space to display how I would like it to. I need to leave the 4 cells, H2:K2 merged.
 

Paul Ked

Active Member
Joined
Jun 4, 2015
Messages
442
Can you use

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = "$H$2:$K$2" Then
        frmCalendar.Show
        Range("A2").Select
    End If
End Sub
?
 

Watch MrExcel Video

Forum statistics

Threads
1,090,411
Messages
5,414,253
Members
403,522
Latest member
Abel_excel

This Week's Hot Topics

Top