C Chuckles123 Oct 11, 2004 #1 I am a somewhat newbie to VBA. How would you add constants for strin values? Chuckles12
B Bob Phillips Oct 11, 2004 #2 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
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