![]() |
Syntax for a macro to unprotect a union of cells
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 |
Syntax for a macro to unprotect a union of cells
Roy,
allcells.Locked = False hth, Doug "Roy Peck" wrote in message ... 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 |
Syntax for a macro to unprotect a union of cells
Entered "allcells.Locked = False" into the macro and got the following result
in Excell 2003. Run-time error'1004': Unable to set the Locked property of the Range class. -- roypeck "Doug Glancy" wrote: Roy, allcells.Locked = False hth, Doug "Roy Peck" wrote in message ... 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 |
Syntax for a macro to unprotect a union of cells
Say this is in Sheet1. Try
Sheets("Sheet1").Unprotect allcells.locked = False Sheets("Sheet1").Protect If there is a password involved, you will need to supply it as a parameter to the protect/unprotect methods: Sheets("Sheet1").Unprotect("MyPassword") Hth -John Coleman On Mar 11, 9:18 am, Roy Peck wrote: Entered "allcells.Locked = False" into the macro and got the following result in Excell 2003. Run-time error'1004': Unable to set the Locked property of the Range class. -- roypeck "Doug Glancy" wrote: Roy, allcells.Locked = False hth, Doug "Roy Peck" wrote in message ... 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- Hide quoted text - - Show quoted text - |
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 |
All times are GMT +1. The time now is 07:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com