LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Runtime error with vba and checkbox

Heyas,

Hokay, noob behind the keyboard here and I have a situation I have no
clue on how to fix. I have only had minimal training in visual basic.
So any explanations in monosyllabic terms will be greatly appreciated.
Situation: I'm making a spreadsheet and want to limit access by users
to change data. I have a button that will generate data in the
necessary fields. I have an checkbox that when selected should disable
the commandbutton from functioning as well as locking the fields that
had information generated in them.
Here is the catch. When the sheet is unprotected the button and
checkbox do not lock the data fields or diable the command button, but
no error. But when I turn on the protection, I get an error '1004'
Unable to set the Locked property of the range class when I click on
the checkbox every time.

Here is the code:

Private Sub CheckBox1_Click()
' chkLockAttribs_Click()
ActiveWindow.ScrollRow = 8

Sheets("Stats").Range("C18").Select
If CheckBox1.Enabled = True Then
Sheets("Stats").Range("C18, D19:D23, D25, D26:F26, J19:J23,
P33, P35").Select
Selection.Locked = True
CommandButton1.Visible = False
Else
Sheets("Stats").Range("C18, D19:D23, D25, D26:F26, J19:J23,
P33, P35").Select
Selection.Locked = False
CommandButton1.Visible = True
End If

Sheets("Stats").Range("D19").Select
End Sub


Any help would be greatly appreciated. Thanks.

-SplatterKat-

 
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
checkbox in runtime [email protected] Excel Programming 1 April 15th 06 11:05 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Interior class error/runtime error 1004 David Goodall Excel Programming 1 October 24th 04 10:16 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


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