Command Button Clearing Text

Aron19

New Member
Joined
Sep 14, 2011
Messages
20
I have yes and no buttons that I am using to display different text. I need to make it so if you accidentally clicked the yes button that shows 4 lines of text, and then you click the No button which only shows 2 lines of data that the extra 2 lines from the Yes button dont still show up.

I know it sounds confusing but it shouldnt be too difficult to fix I wouldnt think.

HELP!!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
What I am saying is that I am giving the user the option to click yes or no depending on where they are in the process to get to the next steps. If the person clicks YES then 4 lines of text show up below the YES button, but if they accidentally hit the YES button and meant to hit NO instead they will only get 2 lines of text below the buttons.

Problem I am having is that if you did hit YES you get 4 lines of text, but if you go back and hit NO you only get 2 lines and the extra 2 lines from your previous YES button still show up under the 2 you get from selecting NO.

I just want it so if you hit NO it deletes whatever might have been there from when you hit YES or vice versa
 
Upvote 0
Private Sub CommandButton1_Click()
Range("A12").Value = "4"
Range("B12").Value = "Has Engineering identified potential supplier?"
Range("C12").Value = "Engineering has identified supplier in Whirlpool base that is capable of producing components"
End Sub

Private Sub CommandButton2_Click()
Range("A12").Value = "4"
Range("A13").Value = "5"
Range("A14").Value = "6"
Range("A15").Value = "7"
Range("B12").Value = "Identify Target Cost representative"
Range("B13").Value = "Identify Commodity Buyer for component RFQ"
Range("B14").Value = "Identify Commodity Buyer for tooling RFQ"
Range("B15").Value = "Other"
Range("C12").Value = "Determine who in the Target Cost group will work on this project?"
Range("C13").Value = "Determine which Commodity Buyer will sending out RFQ's for these components"
Range("C14").Value = "Determine which Commodity Buyer will send out RFQ's for tooling these components"
Range("C15").Value = "Is there any other information or groups that need to be involved?"
End Sub


Thats what I have so far but I need to know how to make the command buttons clear the data from the previous command button if it was hit. Also need to know how to make new command buttons show up once a certain command button has been keyed
 
Upvote 0
Now do I need to just put that under the yes box and then adapt it for the no box based on cell numbers?
 
Upvote 0
That worked amazing!!! Thank you very much!!

How do I get new command boxes to show up based on the previous command button that was clicked. I know that I have to hide them until the previous button is clicked but I have no idea of how to get them to show up once that has been done.

Thanks!
 
Upvote 0
to hide/unhide you use .visible so for example

checkbox3.visible = true would show checkbox3
 
Upvote 0
So if I have:

Private Sub CommandButton1_Click()

and I need to show Commandbutton4 how would I show the code?
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,242
Members
452,898
Latest member
Capolavoro009

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
Back
Top