Button in VBA code

Annemus

New Member
Joined
May 22, 2011
Messages
15
Hello
I want to know if it is possible to write on the botton's made in VBA code

Instead of YesNo bottons I want to write on the botton.

Right now I have this instead:

sType = MsgBox("Does the car drive on gas?", vbYesNo)
If sType = vbYes Then
Range("B5").Value = "Gas"
sType = "gas"
ElseIf sType = vbNo Then
Range("B5").Value = "Diesel"
sType = "diesel"
End If

Is it possible to write "What does the car drive on?", and then have to buttons with gas or diesel ??

Thanks
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hello
I want to know if it is possible to write on the botton's made in VBA code

Instead of YesNo bottons I want to write on the botton.

Right now I have this instead:

sType = MsgBox("Does the car drive on gas?", vbYesNo)
If sType = vbYes Then
Range("B5").Value = "Gas"
sType = "gas"
ElseIf sType = vbNo Then
Range("B5").Value = "Diesel"
sType = "diesel"
End If

Is it possible to write "What does the car drive on?", and then have to buttons with gas or diesel ??

Thanks

It is easier to use a custom userform with the two buttons .
 
Upvote 0
Then you'd be able to use radio buttons if you wanted to.
 
Upvote 0
Radio buttons are... well, radio buttons. You know - radio buttons!

CustomDialogTestpublic.PNG


Forget those anyway - if you want a MsgBox with your own captions on the buttons you'll have to design a userform:-

gg597509.053a12b8-e739-4bca-a93c-f1b71d661fa6(en-us,Office.14).jpg


I've just tried Googling excel userform msgbox and there are any number of examples of how to do this, all of them better than I could manage, I'm sure.

Try one or two of them and see how you get on. If you get stuck, come back to us.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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