ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SIMPLE UserForm w/ 2 OPTION BUTTONS (https://www.excelbanter.com/excel-programming/313177-simple-userform-w-2-option-buttons.html)

Chuckles123[_39_]

SIMPLE UserForm w/ 2 OPTION BUTTONS
 

I am a somewhat newbie to VBA. How would you add constants for strin
values?
Chuckles12

--
Chuckles12
-----------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...fo&userid=1494
View this thread: http://www.excelforum.com/showthread.php?threadid=26805


Bob Phillips[_6_]

SIMPLE UserForm w/ 2 OPTION BUTTONS
 
For your code I would do something like

Public Const sOption1 As String = "EVAL"
Public Const sOption2 As String = "BID"

Public Button As String
Sub CREATE_FORM()
'
frmPricing.Show
'SHOW Pricing UserForm ON DISPLAY

'USER SELECTS BUTTON

'AFTER SELECTION, CONTROL COMES BACK HERE
If Button = sOption1 Then
Range("A1").Select

ElseIf ton = sOption2 Then
Range("C1").Select

Else
Msgbox "Error in selection"

End If

End Sub

'BELOW IS CODE FOR EACH OF 2 OPTION BUTTONS

Private Sub optEVAL_Prices_Click()
Button = sOption1
Unload Me
End Sub

Private Sub optBID_Prices_Click()
Button = sOptions2
Unload Me
End Sub


--

HTH

RP

"Chuckles123" wrote in message
...

I am a somewhat newbie to VBA. How would you add constants for string
values?
Chuckles123


--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile:

http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=268057




Tom Ogilvy

SIMPLE UserForm w/ 2 OPTION BUTTONS
 
Const sSTRING as String = "ABCD"

--
Regards,
Tom Ogilvy


"Chuckles123" wrote in message
...

I am a somewhat newbie to VBA. How would you add constants for string
values?
Chuckles123


--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile:

http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=268057





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

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