Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Reset radio buttons w/ protected worksheet

I have a macro connected to a command button that clears all the radio
buttons on a worksheet. Only problem is when the worksheet is protected it no
longer works and gives me error #400. What do I need to do to clear
everything when locked? Here is my current code:

Sub ResetAll()
Dim OptBtn As OptionButton
With ActiveSheet
.Cells.Interior.ColorIndex = xlNone
For Each OptBtn In .OptionButtons
OptBtn.Value = False
Next OptBtn
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Reset radio buttons w/ protected worksheet

Try....

Sub ResetAll()
Dim OptBtn As OptionButton
With ActiveSheet
.Unprotect Password:="myPassword"
.Cells.Interior.ColorIndex = xlNone
For Each OptBtn In .OptionButtons
OptBtn.Value = False
Next OptBtn
.Protect Password:="myPassword"
End With
End Sub

--

Regards,
Nigel




"dgold82" wrote in message
...
I have a macro connected to a command button that clears all the radio
buttons on a worksheet. Only problem is when the worksheet is protected it
no
longer works and gives me error #400. What do I need to do to clear
everything when locked? Here is my current code:

Sub ResetAll()
Dim OptBtn As OptionButton
With ActiveSheet
.Cells.Interior.ColorIndex = xlNone
For Each OptBtn In .OptionButtons
OptBtn.Value = False
Next OptBtn
End With
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Reset radio buttons w/ protected worksheet

Thank you! Works perfectly.

"Nigel" wrote:

Try....

Sub ResetAll()
Dim OptBtn As OptionButton
With ActiveSheet
.Unprotect Password:="myPassword"
.Cells.Interior.ColorIndex = xlNone
For Each OptBtn In .OptionButtons
OptBtn.Value = False
Next OptBtn
.Protect Password:="myPassword"
End With
End Sub

--

Regards,
Nigel




"dgold82" wrote in message
...
I have a macro connected to a command button that clears all the radio
buttons on a worksheet. Only problem is when the worksheet is protected it
no
longer works and gives me error #400. What do I need to do to clear
everything when locked? Here is my current code:

Sub ResetAll()
Dim OptBtn As OptionButton
With ActiveSheet
.Cells.Interior.ColorIndex = xlNone
For Each OptBtn In .OptionButtons
OptBtn.Value = False
Next OptBtn
End With
End Sub



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
Reset button code for Radio Buttons [email protected] Excel Discussion (Misc queries) 6 August 25th 12 03:09 PM
Is it possible to have two groups of radio buttons on a worksheet? Bob Arnett Excel Worksheet Functions 5 December 17th 08 08:53 PM
How can I reset an Excel form that has radio buttons. JaxPM Excel Programming 5 May 4th 06 03:51 AM
Two sets of radio buttons on a worksheet? Ctech[_136_] Excel Programming 1 April 4th 06 04:36 PM
radio button on protected worksheet Rog[_4_] Excel Programming 3 December 29th 04 08:07 PM


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