View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Roy Peck Roy Peck is offline
external usenet poster
 
Posts: 4
Default Syntax for a macro to unprotect a union of cells

Tried the code as stand alone
got a run-time error 424: object required.
Inserted the code at the end of the macro that defines "Allcells" as a union
and got the same 1004 error.

The following 2 lines of code do work in the same macro that defines
"Allcells"
allcells.Value = "" ' clear all cells
allcells.Font.ColorIndex = 5 'set all cells to blue

Excell 2003 Vesta. "Allcells" is over 100 cells, all of which are merged
cells.
Changing the protection cell by cell one at a time does work and is a
workaround. The workaround is slow.

Within nested Do loops
Sheets("sheet1").range("b2").offset(I*5,J*5).selle ct
Selection.Locked = False

roypeck


"Roy Peck" wrote:

Have a union of a hundred cells similar to the line of code below.
set cell???? = range("??")
Set allcell = Application.Union(cell1720, cell1721, cell1722)
allcells.Value = ""
allcells.Font.ColorIndex = 0

What is the syntax to unprotect all cells in "allcell"
--
roypeck