Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating VB form by changing cells
I need to know how I can show a UserForm or run other code by selecting or changing the value of a cell in Excel? Without using a VB object such as a command button that needs to be clicked.
A B C D E i.e. - 1 | | 4 | | | 2 | | | | | 3 | | | | | If the contents of cell C1 are changed to "6", a UserForm should appear. The Sub Worksheet_SelectionChange() does not seem to work. Need Help Please!!!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating VB form by changing cells
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("C1")) Is Nothing Then If Target.Value = 6 Then Userform1.Show End If End If ws_exit: Application.EnableEvents = True End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "CTInt04" wrote in message ... I need to know how I can show a UserForm or run other code by selecting or changing the value of a cell in Excel? Without using a VB object such as a command button that needs to be clicked. A B C D E i.e. - 1 | | 4 | | | 2 | | | | | 3 | | | | | If the contents of cell C1 are changed to "6", a UserForm should appear. The Sub Worksheet_SelectionChange() does not seem to work. Need Help Please!!!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activating VB form by changing cells
This works too.. A little simpler..
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$1" And Target.Value = 6 Then MsgBox "Tada" 'Open your form here... End If End Sub "Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("C1")) Is Nothing Then If Target.Value = 6 Then Userform1.Show End If End If ws_exit: Application.EnableEvents = True End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "CTInt04" wrote in message ... I need to know how I can show a UserForm or run other code by selecting or changing the value of a cell in Excel? Without using a VB object such as a command button that needs to be clicked. A B C D E i.e. - 1 | | 4 | | | 2 | | | | | 3 | | | | | If the contents of cell C1 are changed to "6", a UserForm should appear. The Sub Worksheet_SelectionChange() does not seem to work. Need Help Please!!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Activating cells with checkbox | Excel Worksheet Functions | |||
Dynamically Activating Cells | Excel Discussion (Misc queries) | |||
Activating a modeless form | Excel Programming | |||
Activating a worksheet with a user form open on the screen | Excel Programming | |||
Copy one spreadsheet into another without activating second spreadsheet's user form | Excel Programming |