Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Combobox & locked cells

Below is some combobox code code I'm having a problem with. Hopefully
someone can tell me where I'm going wrong. I've narrowed it down to the
problem area, but I'm not sure what's going wrong.

Private Sub ComboBox1_Change()
Worksheets(1).Unprotect
Worksheets(1).Range("B3").Locked = False
--------
More code
This part works OK
--------
Worksheets(1).Range("B3").Locked = True
Worksheets(1).Protect
End Sub

The code in the middle works fine (various If statements) so I've taken it
out. Without the "B3" lines, everything's OK. When the combobox changes, the
sheet is unlocked to allow changes to some of the cells, entering values and
locking/unlocking them as necessary. However, when I introduce the "B3"
lines I get an Excel error telling me the cell is protected. B3 is the
linked cell to the combobox. I wanted to avoid users being able to select
certain cells, including the ones linked to comboboxes.

Can anyone help?

Ian


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox & locked cells

Ian

It shouldn't matter whether or not B3 is locked; all cells
are by default. It only has any effect when the sheet is
protected.

As the problem referes to B3 I'd delete any reference to
it in the macro.

Hope it works
Regards
Peter
-----Original Message-----
Below is some combobox code code I'm having a problem

with. Hopefully
someone can tell me where I'm going wrong. I've narrowed

it down to the
problem area, but I'm not sure what's going wrong.

Private Sub ComboBox1_Change()
Worksheets(1).Unprotect
Worksheets(1).Range("B3").Locked = False
--------
More code
This part works OK
--------
Worksheets(1).Range("B3").Locked = True
Worksheets(1).Protect
End Sub

The code in the middle works fine (various If statements)

so I've taken it
out. Without the "B3" lines, everything's OK. When the

combobox changes, the
sheet is unlocked to allow changes to some of the cells,

entering values and
locking/unlocking them as necessary. However, when I

introduce the "B3"
lines I get an Excel error telling me the cell is

protected. B3 is the
linked cell to the combobox. I wanted to avoid users

being able to select
certain cells, including the ones linked to comboboxes.

Can anyone help?

Ian


.

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
ComboBox for a range of cells Malka Excel Discussion (Misc queries) 2 February 16th 10 09:04 PM
Locked worksheet & hyperlinks (w/ select locked cells unchecked) dgold82 Excel Discussion (Misc queries) 1 July 10th 09 09:42 PM
Combobox locked Maggie Excel Discussion (Misc queries) 1 February 23rd 07 03:47 PM
paste locked cells and unlocked cells in protected sheet Angeline Excel Worksheet Functions 15 November 1st 06 11:51 PM
Put comments on a locked spreadsheet even though cells not locked RDP Excel Worksheet Functions 1 September 11th 05 11:59 PM


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