Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need help re VBA for Worksheet Open Event | Excel Programming | |||
How do I lock a radio button group if a N/A button is selected | Excel Discussion (Misc queries) | |||
radio button on protected worksheet | Excel Programming | |||
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True | Excel Worksheet Functions | |||
Initializing variable vs. comand button | Excel Programming |