Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changes cells from combobox on protected sheet??

Status
Not open for further replies.

GrahamUNC

Programmer
Mar 30, 2001
14
US
So here's the deal:
I have 10-15 comboboxes on one sheet where you can select various items from them. The selections from the comboboxes are then placed in cells in other worksheets of the same workbook. There is an option to select nothing from the combobox (ie blank line). If the blank line is selected then the row in the other worksheets where the selection is placed is then hidden.

This works all well and good until I protect each sheet. I have to have the cells where the combobox selctions end up protected because I want the user to be only able to select one of my choices.

I thought that I'd write a sub that I could call at the beginning of the combobox change sub that would just unprotect all the sheets and then another that would protect them when the sub was finished.

Sub Unprotect()
For Each ws in Worksheets
ws.Unprotect
Next ws
End Sub

Sub Protect()
For Each ws in Worksheets
ws.Protect
Next ws
End Sub

This subs work well as stand alone subs but when I try to call them at the beginning or end of the combobox change sub they get an error.

I'd appreciate any help that anyone could give. Or if someone knew a better way to go about this, that would be great too. Thanks in advance.
 
It may be that because the ComboBox has the focus VBA can't recognise the sheets. If so, the easiest way around it is to start the ComboBox_Change() subroutine with Range("A1").Activate (or any other cell) to remove the focus from the ComboBox. Store300

Store300@ftnetwork.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top