ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MsgBox Replacement w/ an UserForm (https://www.excelbanter.com/excel-programming/313087-msgbox-replacement-w-userform.html)

Chuckles123[_36_]

MsgBox Replacement w/ an UserForm
 

Sub ShowForm()
Dim Button As String
frmPricing_Options_UserForm.Show
If Button = "EVAL" Then
Range("A1").Select
Else
Range("C1").Select
End If
End Sub

Private Sub optEval_Prices_Click()
Button = "EVAL"
Unload Me
End Sub

Private Sub optBid_Prices_Click()
Button = "BID"
Unload Me
End Sub

When the macro is executed, Cell C1 is selected even when the EVA
Option Button is clicked.

Thanks again,
Chuckles12

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


Bob Phillips[_6_]

MsgBox Replacement w/ an UserForm
 
Okay, that is easy.

Because you Don't declare the Button variable as a global variable, the
option button routines are not setting the variable you think they are, but
rather an implicit Form class variable called Button.

In you standard code module, change the ShowForm code to this

Public Button As String

Sub ShowForm()frmPricing_Options_UserForm.Show
If Button = "EVAL" Then
Range("A1").Select
Else
Range("C1").Select
End If
End Sub

--

HTH

RP

"Chuckles123" wrote in message
...

Sub ShowForm()
Dim Button As String
frmPricing_Options_UserForm.Show
If Button = "EVAL" Then
Range("A1").Select
Else
Range("C1").Select
End If
End Sub

Private Sub optEval_Prices_Click()
Button = "EVAL"
Unload Me
End Sub

Private Sub optBid_Prices_Click()
Button = "BID"
Unload Me
End Sub

When the macro is executed, Cell C1 is selected even when the EVAL
Option Button is clicked.

Thanks again,
Chuckles123


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

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




Mike Fogleman

MsgBox Replacement w/ an UserForm
 
It seems you are setting Button="EVAL" in a Private Sub and trying to
use that in a general module Dimmed within a procedure.
Try - Public Button As String - at the top of the general module.

Mike F

"Chuckles123" wrote in message
...

Sub ShowForm()
Dim Button As String
frmPricing_Options_UserForm.Show
If Button = "EVAL" Then
Range("A1").Select
Else
Range("C1").Select
End If
End Sub

Private Sub optEval_Prices_Click()
Button = "EVAL"
Unload Me
End Sub

Private Sub optBid_Prices_Click()
Button = "BID"
Unload Me
End Sub

When the macro is executed, Cell C1 is selected even when the EVAL
Option Button is clicked.

Thanks again,
Chuckles123


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

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





All times are GMT +1. The time now is 01:00 PM.

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