![]() |
How do I set option button value using VBA
I have a option button control on my spread sheet and I want to be able to
set the value to either True or False using VBA code. How do I refer to that object with in my Worksheet. What I am trying to do is have VBA set will say OptButton1 to False upon the workbook being closed. Keep in mind the option button is an object in a worksheet Not a control on a User Form. Please Anyone , Help ? Dan Thompson |
How do I set option button value using VBA
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Sheet1").OptionButton1 = False End Sub "Dan Thompson" wrote: I have a option button control on my spread sheet and I want to be able to set the value to either True or False using VBA code. How do I refer to that object with in my Worksheet. What I am trying to do is have VBA set will say OptButton1 to False upon the workbook being closed. Keep in mind the option button is an object in a worksheet Not a control on a User Form. Please Anyone , Help ? Dan Thompson |
How do I set option button value using VBA
I wouldn't put it in the code before the workbook closes. The user can still
answer no to the save prompt (or you could save without asking and maybe damage the workbook???). I'd put the code in a procedure that runs when the workbook opens: Option Explicit Sub Auto_Open() worksheets("sheet999").optionbutton1.value = false end sub Dan Thompson wrote: I have a option button control on my spread sheet and I want to be able to set the value to either True or False using VBA code. How do I refer to that object with in my Worksheet. What I am trying to do is have VBA set will say OptButton1 to False upon the workbook being closed. Keep in mind the option button is an object in a worksheet Not a control on a User Form. Please Anyone , Help ? Dan Thompson -- Dave Peterson |
All times are GMT +1. The time now is 05:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com