Link to home
Start Free TrialLog in
Avatar of Amy Stafford
Amy Stafford

asked on

UserForm when click on cell but not entire row!

Hi all

I have some userforms in a spreadsheet that I want to appear when the user clicks on a cell in the relevant column. However, when I highlight a row, the userforms pop up a number of times and I have to manually close them all down - is there a way to stop the userforms coming up when the whole row is selected please?

This is the code that I have in the objects for Sheet 1;
Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Application.Intersect(Target, Range("I4:I302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("K4:K302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("P4:P302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("Q4:Q302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("S4:S302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("T4:T302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("W4:W302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("AB4:AB302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("AF4:AF302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("AG4:AG302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("AH4:AH302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("AI4:AI302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("AK4:AK302")) Is Nothing Then UserForm2.Show
    If Not Application.Intersect(Target, Range("AN4:AN302")) Is Nothing Then UserForm1.Show
End Sub

Open in new window


Thanks
Amy
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Amy Stafford
Amy Stafford

ASKER

Perfect, thank you!
You're welcome Amy!