Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Initializing a radio button on worksheet open event

I have two radio buttons created on Sheet1 of a 3-sheet workbook. I
have named the buttons opMemo and opNoMemo in the Properties of each.
When clicked, the buttons change the text of several cells on Sheet1
via _Click events. My problem is this: I want the opNoM button to be
checked when the workbook is opened.

I have this code under ThisWorkbook:

Private Sub Workbook_open()
Call opNoM
End Sub

The procedure opNoM is in a Module in the Project and looks like this:

Public Sub opNoM()
.... change the text in various cells on Sheet1
End Sub

This successfully sets up the sheet for the NoMemo mode, but if the
opMemo button was checked the last time the workbook was saved, it is
still checked when the workbook is opened. How do I ensure that the
opNoMemo button is checked when the workbook is opened?

Any help is greatly appreciated.
AllanK

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Initializing a radio button on worksheet open event

Hi Allan

You can set the value of the control

ControlName.Value = True


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message ps.com...
I have two radio buttons created on Sheet1 of a 3-sheet workbook. I
have named the buttons opMemo and opNoMemo in the Properties of each.
When clicked, the buttons change the text of several cells on Sheet1
via _Click events. My problem is this: I want the opNoM button to be
checked when the workbook is opened.

I have this code under ThisWorkbook:

Private Sub Workbook_open()
Call opNoM
End Sub

The procedure opNoM is in a Module in the Project and looks like this:

Public Sub opNoM()
.... change the text in various cells on Sheet1
End Sub

This successfully sets up the sheet for the NoMemo mode, but if the
opMemo button was checked the last time the workbook was saved, it is
still checked when the workbook is opened. How do I ensure that the
opNoMemo button is checked when the workbook is opened?

Any help is greatly appreciated.
AllanK

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Initializing a radio button on worksheet open event

Or change the value of the linked cell.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Ron de Bruin" wrote in message
...
Hi Allan

You can set the value of the control

ControlName.Value = True


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message
ps.com...
I have two radio buttons created on Sheet1 of a 3-sheet workbook. I
have named the buttons opMemo and opNoMemo in the Properties of each.
When clicked, the buttons change the text of several cells on Sheet1
via _Click events. My problem is this: I want the opNoM button to be
checked when the workbook is opened.

I have this code under ThisWorkbook:

Private Sub Workbook_open()
Call opNoM
End Sub

The procedure opNoM is in a Module in the Project and looks like this:

Public Sub opNoM()
.... change the text in various cells on Sheet1
End Sub

This successfully sets up the sheet for the NoMemo mode, but if the
opMemo button was checked the last time the workbook was saved, it is
still checked when the workbook is opened. How do I ensure that the
opNoMemo button is checked when the workbook is opened?

Any help is greatly appreciated.
AllanK



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Initializing a radio button on worksheet open event

If I do

Public Sub opNoM()
opNoMemo.Value = True
.. do more stuff
End Sub

I get a "Compile Error, Variable not defined" even though the Radio
Button Name has been set to opNoMemo in its Properties

I know I'm missing something basic here, please bear with me...


On May 2, 2:57 pm, "Jon Peltier"
wrote:
Or change the value of the linked cell.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutionshttp://PeltierTech.com
_______

"Ron de Bruin" wrote in . ..

Hi Allan


You can set the value of the control


ControlName.Value = True


--


Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message
ups.com...
I have two radio buttons created on Sheet1 of a 3-sheet workbook. I
have named the buttons opMemo and opNoMemo in the Properties of each.
When clicked, the buttons change the text of several cells on Sheet1
via _Click events. My problem is this: I want the opNoM button to be
checked when the workbook is opened.


I have this code under ThisWorkbook:


Private Sub Workbook_open()
Call opNoM
End Sub


The procedure opNoM is in a Module in the Project and looks like this:


Public Sub opNoM()
.... change the text in various cells on Sheet1
End Sub


This successfully sets up the sheet for the NoMemo mode, but if the
opMemo button was checked the last time the workbook was saved, it is
still checked when the workbook is opened. How do I ensure that the
opNoMemo button is checked when the workbook is opened?


Any help is greatly appreciated.
AllanK



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Initializing a radio button on worksheet open event

OK, this is what I did to get around the problem. The selection of
Memo vs. NoMemo is only done once, when the workbook is opened, so,
instead of embedding the two radio buttons on Sheet1, I created a
UserForm with the two radio buttons and an OK button on it. The
Workbook_Open event loads the form, and then this code does what I
wanted:

Private Sub Workbook_Open()
Call opNoM 'This does the various cell
text changes to default to NoMemo
With fmSelect
.opNoMemo.Value = True
.Show
End With
unload fmSelect
End Sub

I guess my previous problem was the fact that the two buttons were not
on a form, per se, just on the worksheet itself.

Cheers,
Allan

On May 2, 4:24 pm, wrote:
If I do

Public Sub opNoM()
opNoMemo.Value = True
.. do more stuff
End Sub

I get a "Compile Error, Variable not defined" even though the Radio
Button Name has been set to opNoMemo in its Properties

I know I'm missing something basic here, please bear with me...

On May 2, 2:57 pm, "Jon Peltier"
wrote:

Or change the value of the linked cell.


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutionshttp://PeltierTech.com
_______


"Ron de Bruin" wrote in . ..


Hi Allan


You can set the value of the control


ControlName.Value = True


--


Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message
ups.com...
I have two radio buttons created on Sheet1 of a 3-sheet workbook. I
have named the buttons opMemo and opNoMemo in the Properties of each.
When clicked, the buttons change the text of several cells on Sheet1
via _Click events. My problem is this: I want the opNoM button to be
checked when the workbook is opened.


I have this code under ThisWorkbook:


Private Sub Workbook_open()
Call opNoM
End Sub


The procedure opNoM is in a Module in the Project and looks like this:


Public Sub opNoM()
.... change the text in various cells on Sheet1
End Sub


This successfully sets up the sheet for the NoMemo mode, but if the
opMemo button was checked the last time the workbook was saved, it is
still checked when the workbook is opened. How do I ensure that the
opNoMemo button is checked when the workbook is opened?


Any help is greatly appreciated.
AllanK





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Initializing a radio button on worksheet open event

Throw away the userform. If your radio buttons are Forms toolbar option
buttons, use this:

activeworkbook.worksheets(1).optionbuttons("opNoM" ).value = true

If they are Controls Toolbox option buttons, use this:

activeworkbook.worksheets(1).opNoM.value = true

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


wrote in message
oups.com...
OK, this is what I did to get around the problem. The selection of
Memo vs. NoMemo is only done once, when the workbook is opened, so,
instead of embedding the two radio buttons on Sheet1, I created a
UserForm with the two radio buttons and an OK button on it. The
Workbook_Open event loads the form, and then this code does what I
wanted:

Private Sub Workbook_Open()
Call opNoM 'This does the various cell
text changes to default to NoMemo
With fmSelect
.opNoMemo.Value = True
.Show
End With
unload fmSelect
End Sub

I guess my previous problem was the fact that the two buttons were not
on a form, per se, just on the worksheet itself.

Cheers,
Allan

On May 2, 4:24 pm, wrote:
If I do

Public Sub opNoM()
opNoMemo.Value = True
.. do more stuff
End Sub

I get a "Compile Error, Variable not defined" even though the Radio
Button Name has been set to opNoMemo in its Properties

I know I'm missing something basic here, please bear with me...

On May 2, 2:57 pm, "Jon Peltier"
wrote:

Or change the value of the linked cell.


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutionshttp://PeltierTech.com
_______


"Ron de Bruin" wrote in
. ..


Hi Allan


You can set the value of the control


ControlName.Value = True


--


Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message
ups.com...
I have two radio buttons created on Sheet1 of a 3-sheet workbook. I
have named the buttons opMemo and opNoMemo in the Properties of
each.
When clicked, the buttons change the text of several cells on Sheet1
via _Click events. My problem is this: I want the opNoM button to
be
checked when the workbook is opened.


I have this code under ThisWorkbook:


Private Sub Workbook_open()
Call opNoM
End Sub


The procedure opNoM is in a Module in the Project and looks like
this:


Public Sub opNoM()
.... change the text in various cells on Sheet1
End Sub


This successfully sets up the sheet for the NoMemo mode, but if the
opMemo button was checked the last time the workbook was saved, it
is
still checked when the workbook is opened. How do I ensure that the
opNoMemo button is checked when the workbook is opened?


Any help is greatly appreciated.
AllanK





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help re VBA for Worksheet Open Event LucyRB Excel Programming 5 January 12th 06 07:01 PM
How do I lock a radio button group if a N/A button is selected worry a lot Excel Discussion (Misc queries) 2 May 21st 05 08:33 PM
radio button on protected worksheet Rog[_4_] Excel Programming 3 December 29th 04 08:07 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM
Initializing variable vs. comand button M. Excel Programming 3 September 16th 03 10:27 AM


All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"