View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter Atherton[_20_] Peter Atherton[_20_] is offline
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


.