ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Preloading value into Option Button (https://www.excelbanter.com/excel-programming/324919-preloading-value-into-option-button.html)

ExcelMonkey[_190_]

Preloading value into Option Button
 
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks

Bob Phillips[_6_]

Preloading value into Option Button
 
Why not just use

Me.Optionbutton1.Value = True

in the Userform_Activate event?

But be aware, if you have a click event for that button, it will be
triggered.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote in message
...
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks




ExcelMonkey[_190_]

Preloading value into Option Button
 
So just our of curiosity Bob. I have not been using a
Userform_Activation event. I have been calling the form
and attempting to set it up prior to the Call stmt as seen
below. Accordingly, I was going to follow through with
the PrintHyperLinkOptionButton = True at the bottom.
Should I move all of this into a Userform_Activation event?

Sub AuditCell()


UserForm1.CircularityChkBx.Enabled = False
UserForm1.InputsChkBx.Enabled = False
UserForm1.ExternalLinkChkBx.Enabled = False
UserForm1.UniqueFormulasChkBx.Enabled = False

UserForm1.PrintColourMapOptionButton.Enabled = False

UserForm1.ComboBox1.Enabled = False

UserForm1.UniqueFormulasAdjustChkBx.Enabled = False

PrintHyperLinkOptionButton = True

UserForm1.Show

End Sub




-----Original Message-----
Why not just use

Me.Optionbutton1.Value = True

in the Userform_Activate event?

But be aware, if you have a click event for that button,

it will be
triggered.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote

in message
...
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following

below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks



.


ExcelMonkey[_190_]

Preloading value into Option Button
 

This doesn't seem to work:

Private Sub UserForm1_Activate()
Me.PrintHyperLinkOptionButton.Value = True
End Sub

Now I am still using the sub below and your refinement.
Cannot I not do this?

Sub AuditCell()


UserForm1.CircularityChkBx.Enabled = False
UserForm1.InputsChkBx.Enabled = False
UserForm1.ExternalLinkChkBx.Enabled = False
UserForm1.UniqueFormulasChkBx.Enabled = False

UserForm1.PrintColourMapOptionButton.Enabled = False

UserForm1.ComboBox1.Enabled = False

UserForm1.UniqueFormulasAdjustChkBx.Enabled = False

UserForm1.Show

End Sub



-----Original Message-----
Why not just use

Me.Optionbutton1.Value = True

in the Userform_Activate event?

But be aware, if you have a click event for that button,

it will be
triggered.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote

in message
...
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following

below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks



.


Bob Phillips[_6_]

Preloading value into Option Button
 
That's not a clear-cut question. I think you need to understand the order of
events and work out what is best for your app.

If you set the form as you are doing outwith the form module, then you
automatically load the form if it is not loaded, that is the form is loaded
into memory but not shown.

When you load the form, the Userform_Initialize event is triggered, so you
could put that code in Initialize if it is required to refresh whenever a
for is loaded.

When you show the form the Userform_Activate event is triggered. So you can
add code here that you want every time the form is shown (which you control
via code remember).

The problem (?) with doing it outwith the form module is that it is
effectively Initialize event when you might want it to be Activate event.

Generally speaking, I try to avoid setting the form from a standard code
module, preferring to do it from within the form module itself. Of course,
there are always exceptions, such as hiding (not unloading) a form and
testing a form public property from the standard code module to determine
next action.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote in message
...
So just our of curiosity Bob. I have not been using a
Userform_Activation event. I have been calling the form
and attempting to set it up prior to the Call stmt as seen
below. Accordingly, I was going to follow through with
the PrintHyperLinkOptionButton = True at the bottom.
Should I move all of this into a Userform_Activation event?

Sub AuditCell()


UserForm1.CircularityChkBx.Enabled = False
UserForm1.InputsChkBx.Enabled = False
UserForm1.ExternalLinkChkBx.Enabled = False
UserForm1.UniqueFormulasChkBx.Enabled = False

UserForm1.PrintColourMapOptionButton.Enabled = False

UserForm1.ComboBox1.Enabled = False

UserForm1.UniqueFormulasAdjustChkBx.Enabled = False

PrintHyperLinkOptionButton = True

UserForm1.Show

End Sub




-----Original Message-----
Why not just use

Me.Optionbutton1.Value = True

in the Userform_Activate event?

But be aware, if you have a click event for that button,

it will be
triggered.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote

in message
...
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following

below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks



.




Bob Phillips[_6_]

Preloading value into Option Button
 
That is because the event is cal;led Userform_Activate. It is a form event,
not that form name event :-).

see my other response for the other bit.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote in message
...

This doesn't seem to work:

Private Sub UserForm1_Activate()
Me.PrintHyperLinkOptionButton.Value = True
End Sub

Now I am still using the sub below and your refinement.
Cannot I not do this?

Sub AuditCell()


UserForm1.CircularityChkBx.Enabled = False
UserForm1.InputsChkBx.Enabled = False
UserForm1.ExternalLinkChkBx.Enabled = False
UserForm1.UniqueFormulasChkBx.Enabled = False

UserForm1.PrintColourMapOptionButton.Enabled = False

UserForm1.ComboBox1.Enabled = False

UserForm1.UniqueFormulasAdjustChkBx.Enabled = False

UserForm1.Show

End Sub



-----Original Message-----
Why not just use

Me.Optionbutton1.Value = True

in the Userform_Activate event?

But be aware, if you have a click event for that button,

it will be
triggered.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote

in message
...
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following

below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks



.




Tom Ogilvy

Preloading value into Option Button
 
Private Sub UserForm1_Activate

should be
Private Sub UserForm_Activate

using the generic Userform

If you select your events from the dropdown, you won't have this problem.

--
Regards,
Tom Ogilvy


"ExcelMonkey" wrote in message
...

This doesn't seem to work:

Private Sub UserForm1_Activate()
Me.PrintHyperLinkOptionButton.Value = True
End Sub

Now I am still using the sub below and your refinement.
Cannot I not do this?

Sub AuditCell()


UserForm1.CircularityChkBx.Enabled = False
UserForm1.InputsChkBx.Enabled = False
UserForm1.ExternalLinkChkBx.Enabled = False
UserForm1.UniqueFormulasChkBx.Enabled = False

UserForm1.PrintColourMapOptionButton.Enabled = False

UserForm1.ComboBox1.Enabled = False

UserForm1.UniqueFormulasAdjustChkBx.Enabled = False

UserForm1.Show

End Sub



-----Original Message-----
Why not just use

Me.Optionbutton1.Value = True

in the Userform_Activate event?

But be aware, if you have a click event for that button,

it will be
triggered.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote

in message
...
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following

below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks



.




Tom Ogilvy

Preloading value into Option Button
 
Is there a typo in your explanation?

setting an option button to true Selects it. As written, it sounds like you
have achieved what you desire?

--
Regards,
Tom Ogilvy


"ExcelMonkey" wrote in message
...
I have a a form with Option Buttons. I want to load the
form with one of its buttons at TRUE. The following below
does not work. The form loads with the option button
chosen. Whey is this

PrintHyperLinkOptionButton = True

UserForm1.Show

Thanks





All times are GMT +1. The time now is 12:29 PM.

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