Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default 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 -



  #5   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unprotect in a macro Partly Void[_2_] Excel Discussion (Misc queries) 3 October 5th 08 10:45 AM
unProtect some cells on the spreadsheet Souris Excel Programming 0 August 20th 05 11:56 PM
Union/Range/Cells KentÄ[_3_] Excel Programming 2 March 11th 05 11:14 AM
printing a union of non-contiguous cells- help! noel mcwilliam Excel Programming 0 December 3rd 04 04:15 PM
printing a union of non-contiguous cells- help! noel mcwilliam Excel Programming 0 December 3rd 04 04:13 PM


All times are GMT +1. The time now is 10:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"