Activate Userform with cell selection in excel

  Desert Andy 10:04 18 Dec 07
Locked

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

Function CALL_USERFORM(QUANTITY)
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.

Nintendo Switch review: Hands on with the intuitive modular console and its disappointing games…

1995-2015: How technology has changed the world in 20 years

Here's what should be coming to Adobe Project Felix in 2017

Apple AirPods review: Apple's beautiful new Bluetooth headphones bring true intelligence to…