VBA Hangs on Unlocked Cells When Protected

M

McRolin

Hello All,
I have an VBA macro that changes cell formulas, fonts, and interiors.
The macro works great when the sheet is not protected. But, I want other
parts of the spreadsheet protected. So, I formatted all the cells that the
macro changes and "unlocked" each cell..
I then protected the sheet.
When I ran the macro after the sheet was protected, it hangs on the
first operation to change something in the unlocked cells. Any ideas what
is going on?

Roger
 
F

Frank Kabel

Hi Roger
you have to unprotect the sheet within the macro to let it process the
protected cells. So include statements like the following:

sub foo()
activesheet.unprotect password:="your password"
'...
'...process your cells
activesheet.protect password:="your password"
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top