Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Code for OptionBox

Hello,

I have a sheet where people can choose between two options. I make use of
the OptionButton in the VBA Editor. What I want is that when Option 1 is
chosen, the worksheet fills in the value from A1 in to B1. When Option 2 is
chosen, the value from A2 should be filled in in to B1. How can I achieve
this?

Kind regards,

Noepie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Code for OptionBox

Assuming you are using the option buttons from the Controls command
bar not the Forms command bar, you can use code like the following:


Private Sub OptionButton1_Click()
Range("A1").Value = Range("B1").Value
End Sub

Private Sub OptionButton2_Click()
Range("A2").Value = Range("B1").Value
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Fri, 12 Dec 2008 00:20:00 -0800, Noepie
wrote:

Hello,

I have a sheet where people can choose between two options. I make use of
the OptionButton in the VBA Editor. What I want is that when Option 1 is
chosen, the worksheet fills in the value from A1 in to B1. When Option 2 is
chosen, the value from A2 should be filled in in to B1. How can I achieve
this?

Kind regards,

Noepie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Code for OptionBox

Thanx Chip!

"Chip Pearson" wrote:

Assuming you are using the option buttons from the Controls command
bar not the Forms command bar, you can use code like the following:


Private Sub OptionButton1_Click()
Range("A1").Value = Range("B1").Value
End Sub

Private Sub OptionButton2_Click()
Range("A2").Value = Range("B1").Value
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Fri, 12 Dec 2008 00:20:00 -0800, Noepie
wrote:

Hello,

I have a sheet where people can choose between two options. I make use of
the OptionButton in the VBA Editor. What I want is that when Option 1 is
chosen, the worksheet fills in the value from A1 in to B1. When Option 2 is
chosen, the value from A2 should be filled in in to B1. How can I achieve
this?

Kind regards,

Noepie


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
Excel Equivalent of Access OptionBox LarryP Excel Programming 2 October 30th 07 08:59 PM
Excel Checkboxs, Optionbox Brandon Excel Discussion (Misc queries) 1 January 19th 07 08:25 PM
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM
optionbox checkbox flow23 Excel Discussion (Misc queries) 3 November 24th 05 01:00 PM
OptionBox error checking Patrick Simonds Excel Programming 1 September 29th 05 08:39 AM


All times are GMT +1. The time now is 03:51 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"