Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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 on how to grey out one option button in one group box based on the selection of another option button in another group box George Excel Programming 12 March 11th 07 02:08 PM
keep source formatting is not an option in paste option button Tina Excel Discussion (Misc queries) 0 February 20th 06 09:58 PM
option button? Pete Excel Programming 2 September 11th 05 02:51 PM
Option Button ceemo[_17_] Excel Programming 2 August 26th 05 04:58 PM
option button Mario Excel Discussion (Misc queries) 1 July 26th 05 07:44 PM


All times are GMT +1. The time now is 05:45 PM.

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

About Us

"It's about Microsoft Excel"