Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with a option buttons located in a userform


Hi everyone

I have two option buttons in user form1
I'm wondering what code I would need to use and where it would go
to link the that I have placed in to userform 1 to cell "A1" in
worksheet 'Material takeoff'

this is my first time with userforms and the properties and I'm just a
newbie at VBA

If option buttion 1 in the user form is selected then cell "A1" should
= 1
If option buttion 2 in the user form is selected then cell "A1" should
= 2
if neither are selected it should = 0 or blank
also the value in cell A1 to change before the userform is closed

Thanks in advance for any help


--
mav93
------------------------------------------------------------------------
mav93's Profile: http://www.excelforum.com/member.php...o&userid=31592
View this thread: http://www.excelforum.com/showthread...hreadid=517867

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Help with a option buttons located in a userform

Put this code in your userform (right click on Userform==view code and
copy/paste)

A1 (on Sheet2 in the example .. change to suit your needs ...) is set 0
when the form is loaded.

Optionbutton is TRUE when selected which is numerically -1: hence muliples
of -1 and -2 to get 1 & 2 in A1

HTH

Private Sub OptionButton1_Click()
Worksheets("Sheet2").Range("A1") = OptionButton1.Value * -1
End Sub
Private Sub OptionButton2_Click()
Worksheets("Sheet2").Range("A1") = OptionButton2.Value * -2
End Sub
Private Sub UserForm_Initialize()
Worksheets("Sheet2").Range("A1") = 0 '<=== set A1 to zero
End Sub

"mav93" wrote:


Hi everyone

I have two option buttons in user form1
I'm wondering what code I would need to use and where it would go
to link the that I have placed in to userform 1 to cell "A1" in
worksheet 'Material takeoff'

this is my first time with userforms and the properties and I'm just a
newbie at VBA

If option buttion 1 in the user form is selected then cell "A1" should
= 1
If option buttion 2 in the user form is selected then cell "A1" should
= 2
if neither are selected it should = 0 or blank
also the value in cell A1 to change before the userform is closed

Thanks in advance for any help


--
mav93
------------------------------------------------------------------------
mav93's Profile: http://www.excelforum.com/member.php...o&userid=31592
View this thread: http://www.excelforum.com/showthread...hreadid=517867


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
Changing text size in option buttons on a userform Coen Burger Excel Programming 1 August 7th 05 09:04 AM
Navigating between option buttons is not selecting the option Gixxer_J_97[_2_] Excel Programming 4 June 2nd 05 02:50 PM
SIMPLE UserForm w/ 2 OPTION BUTTONS Chuckles123[_40_] Excel Programming 6 October 12th 04 01:16 PM
SIMPLE UserForm w/ 2 OPTION BUTTONS Chuckles123[_39_] Excel Programming 2 October 11th 04 07:02 PM
SIMPLE UserForm w/ 2 OPTION BUTTONS Chuckles123[_38_] Excel Programming 1 October 11th 04 09:03 AM


All times are GMT +1. The time now is 07:23 PM.

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"