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: 21
Default Locking/unlocking cells

I have a subroutine (cutdown version below) which should lock and unlock
cells based on a cell content.

Private Sub ComboBox2_Change()
Worksheets(1).Unprotect
Application.ScreenUpdating = False

' ----- 17cm CHECK -----
If Range("w3").Value = 17 Then
Range("e9:o9").Locked = True
Else
Range("e9").Locked = False
Range("h9:i9").Locked = False
Range("k9").Locked = False
Range("m9:o9").Locked = False
End If
Worksheets(1).Protect
Application.ScreenUpdating = True

End Sub

W3 is the linked cell to combobox2.

If w3=17, there appears to be no problem, though the cells are already
locked.
If w3<17 I get an eror telling me that the Locked property can not be set
on the Range class.

It nust be something straightforward, but I can't see what.

Any ideas?

TIA

Ian


 
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
Locking/Unlocking based on another cell value Iriemon Excel Worksheet Functions 0 March 27th 08 02:47 PM
locking and unlocking worksheets adam Excel Worksheet Functions 6 October 31st 07 05:31 PM
Locking/Unlocking cells upon condition Brettjg Excel Discussion (Misc queries) 20 March 12th 07 06:01 AM
locking and unlocking a row of data based on whats entered in a cell Joshua F. Excel Programming 2 December 4th 03 06:11 PM
Locking/Unlocking a VBA Project in 2000 vs '97 - Difference? RobNew Excel Programming 3 November 2nd 03 07:29 AM


All times are GMT +1. The time now is 02:17 AM.

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"