Activate Userform with cell selection in excel

  Desert Andy 10:04 18 Dec 07

I have set up a cell validation in an excel worksheet. If possible I would like to activate a userform if the user selects a particular value. I know its possible to write code for a selection change in vb, can I write code so that if the user selects the value 2 in a certain cell, a userform appears.
Many thanks for your help.

  VoG II 11:19 18 Dec 07

Right click the sheet tab, View Code and paste in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "A1" And Target.Value = 2 Then UserForm1.Show
End Sub

This works with values typed into a cell but I haven't tried it with a validation list.

  MADMACx9 12:16 18 Dec 07

not a very elegant method but

in VB (Alt f11)insert module

If QUANTITY = 2 Then UserForm1.Show
End Function

For example:- if (A1) is the test cell then
in (B1) enter formula "= CALL_USERFORM(A1)"

This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

Where HTML5 is headed next

MacBook Pro v Surface Pro 5