Activate Userform (run macro?) from cell value

  • Thread starter Thread starter ziggyg
  • Start date Start date
Z

ziggyg

What would be the code for activating a userform from a cell value? I
Cell A2 of worsheet1, it prompts for a date, (formated to Jan-04), I
the month of july I need other information in the workbook updated so
would like it to open up a userform that queries for all th
information needed updating. I have the user form and it works fine
just haven't been able to connect it to the cell value change.

in essence:

if a2 = july-04 then open that userform, else carry-on

(unfortunately this code didn't work...)

All the help appreciated.

ziggy
 
Try this:
Right Click on the worksheet name and select "View Code", then paste the
following code. Change the name "UserForm1" if necessary.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("a2"), Target(1)) Is Nothing _
And Target.Count = 1 And Target <> "" Then
UserForm1.Show
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top