VBA Hangs on Unlocked Cells When Protected

  • Thread starter Thread starter McRolin
  • Start date Start date
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
 
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
 
Back
Top