Problem showing a userform based on cell value

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
161
Hi all,

I need a userform to be shown if a cell value changes.

At present on a worksheet I have certain cells with data validation in place with "guest" as one of the options to choose. What I would like to happen is if I choose "guest" from the drop down list for my userform to show on it's own. At the moment with the code I have the userform doesn't show when I choose "guest". If I select a different cell and then click back in the cell showing "guest" the userform will launch but I would like it to launch as soon as I choose "guest" on the list.

This is the code I have at the moment

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Value = "Guest" Then
frmAddStaff.Show
End If
    
End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You need to use a change event, rather than a selection change event.
What cells are you interested in?
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,020
Messages
6,122,712
Members
449,093
Latest member
Mnur

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