ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activate Userform (run macro?) from cell value (https://www.excelbanter.com/excel-programming/294901-activate-userform-run-macro-cell-value.html)

ziggyg[_3_]

Activate Userform (run macro?) from cell value
 
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

--
Message posted from http://www.ExcelForum.com


Rocky McKinley

Activate Userform (run macro?) from cell value
 
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

--
Regards,
Rocky McKinley


"ziggyg " wrote in message
...
What would be the code for activating a userform from a cell value? In
Cell A2 of worsheet1, it prompts for a date, (formated to Jan-04), In
the month of july I need other information in the workbook updated so i
would like it to open up a userform that queries for all the
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.

ziggyg


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com