Activating a Form in Excel

Amy DeLuca

New Member
Joined
Oct 18, 2002
Messages
39
If the user types "Yes" in cell A1, I want a form to appear (frmFMB). If "No" then just the text to appear in the cell. Is this possible?
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

dk

MrExcel MVP
Joined
Feb 15, 2002
Messages
2,942
Right click your worksheet tab and choose View Code. This should do what you need:-

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A" And UCase(Target) = "YES" Then frmFMB.Show
End Sub

EDIT - it should say $ then A and then $ and then 1, but for some reason this board doesn't like that

_________________<font face="Impact">Hope this helps,
Dan</font>
This message was edited by dk on 2002-10-22 12:18
 

Amy DeLuca

New Member
Joined
Oct 18, 2002
Messages
39
I don't want the user to have to use uppercase. I have a validation box attached to the cell where the user can only coose "Yes" or "No". How can I rewrite it so that the user can just select the "Yes"?

Thanks for your help!!!
 

Ekim

Well-known Member
Joined
Jun 30, 2002
Messages
1,416
Using DK's code, amend to

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target = "YES" Then frmFMB.Show
End Sub

The macro goes in a sheet module.

Save the file, close it and then re-open it - the macro should "take" (using Excel 97-SR2). The macro works with a validation "Yes/No" drop-down box in cell A1.

Regards,

Mike
 

Amy DeLuca

New Member
Joined
Oct 18, 2002
Messages
39
Ekim...this worked!!! Thank you!
I put a button in the form that says "OK", what is the code that I attach to it to make it close?

Thanks!!!
 

Ekim

Well-known Member
Joined
Jun 30, 2002
Messages
1,416
Amy,
Put this in the form module (while in the VB editor, double click on the form)

Private Sub CommandButton1_Click()
Unload Me ' or Unload frmFMB
End Sub

The code assumes that your Command Button is named CommandButton1 (if not, change to appropriate description).

Regards,


Mike
 

Watch MrExcel Video

Forum statistics

Threads
1,122,514
Messages
5,596,612
Members
414,080
Latest member
penguin23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top