|
-
Mar 16th, 2010, 06:15 PM
#1
Thread Starter
Addicted Member
[RESOLVED] option button
excel options
i have three option button 29, 34, 32
when i click 29 or column 34 column o(14:333) not enable to enter
option 32 only column o (14:333) shoudl enable to enter
coudl you provide the code in vba
thanks
-
Mar 17th, 2010, 07:21 AM
#2
Thread Starter
Addicted Member
Re: option button
Private Sub OptionButton32_Click()
If OptionButton1.Value = True Then cELLS.cOLUMNS [o2:O333] = "YES" ' how do mention the range here
End Sub
Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then cELLS.cOLUMNS [o2:O333] = "NO"
End Sub
-
Mar 17th, 2010, 08:18 AM
#3
Re: option button
Is this what you want?
Code:
Private Sub OptionButton32_Click()
If OptionButton1.Value = True Then Sheets("Sheet1").Range("O2:O333").Value = "YES"
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Mar 17th, 2010, 08:41 AM
#4
Thread Starter
Addicted Member
Re: option button
Kool
is that i can enter in the cell is it not
-
Mar 17th, 2010, 09:13 AM
#5
Thread Starter
Addicted Member
Re: option button
i am trying to do when i click the optionbutton it should allow to enter range 02: 0333
but still failed
If OptionButton1.Value = True Then Sheets("Sheet1").Range("O2:O333").enabled = "YES"
-
Mar 17th, 2010, 11:06 AM
#6
Thread Starter
Addicted Member
Re: option button
could anybody help this
I am trying ot do when i click the option button it does not allow me to enter anything
Private Sub OptionButton60_Click()
Dim RngPST As Range
Set RngPST = Sheets("Sheet1").Range("A14:A600")
Sheets("Sheet1").Range("A14:A600").Value = ""
End Sub
-
Mar 17th, 2010, 01:02 PM
#7
Re: option button
it does not allow me to enter anything
1. Do you get any error messages?
2. Is the worksheet protected?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Mar 17th, 2010, 04:04 PM
#8
Thread Starter
Addicted Member
Re: option button
kool
when i enter in the cell. the cell should not allow to enter anythign when i press option button
-
Mar 17th, 2010, 09:18 PM
#9
Re: option button
try recording a macro of protecting the range
i guess you would have set protection off for all cells, then protection on for the specific range, then protect the worksheet, with or without password
you can try like this
vb Code:
Dim s As Worksheet Set s = Sheets("sheet1") s.UsedRange.Locked = False Range("o14:o333").Locked = True s.Protect "mypass"
to allow access to those cells again just unprotect the sheet
Last edited by westconn1; Mar 18th, 2010 at 03:49 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 18th, 2010, 03:53 AM
#10
Re: option button
 Originally Posted by kamakshi
kool
when i enter in the cell. the cell should not allow to enter anything when i press option button
Well in that case follow what Pete said.
However remember that after you record the macro and if you password protect the worksheet using a password then the macro doesn't show the password so you will have to amend it accordingly for example
Code:
Activesheet.Protect "MyPassword"
similarly to unprotect use this
Code:
Activesheet.UnProtect "MyPassword"
Edit: Pete!!!!! Speedy Pete!!!! you beat me again...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Mar 18th, 2010, 06:24 AM
#11
Thread Starter
Addicted Member
Re: option button
kool pete
is the option button click or do i have to enter in worksheet change event.
when us ther user enters in the cell and press enter or tab or page dpwn it should say the cell shoudl should be blank or when the option button click it should hide the cell and unhide . the cplumns contains validate rule for other option button
-
Mar 18th, 2010, 02:53 PM
#12
Re: option button
you can set the cells to locked (or hide) from the option button
when locked excel gives some message when user tries to edit
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 19th, 2010, 08:00 AM
#13
Thread Starter
Addicted Member
Re: option button
Westconn and kool thanks it works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|