Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Protecting merged cells via Macro

Hi,

Hopefully a simple question. How can I change the protection on merged
cells? The following line of code gives me an error if there are merged
cells in the named range, but works fine if the named range contains no
merged cells:

range("mergedcells").locked = true


Thanks in advance
Shane
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Protecting merged cells via Macro

I tried this and was unable to duplicate your problem. Could you give
some additional information.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Protecting merged cells via Macro

Hi Shane,
the range has to be unmerged before being locked, so try

Range("mergedcells").UnMerge
Range("mergedcells").Locked = True
Range("mergedcells").Merge

Ken Johnson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Protecting merged cells via Macro

I should have used a With/End With...

With Range("mergedcells")
..Unmerge
..Locked = True
..Merge
End With

Ken Johnson

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
Jim Rech's macro won't work (autofitting merged cells) Ron M. Excel Discussion (Misc queries) 4 March 2nd 06 05:07 PM
Macro Paste Special Merged Cells KC[_5_] Excel Programming 0 November 2nd 04 02:09 AM
Need macro to autofit height for merged cells FishMan123 Excel Programming 1 October 7th 04 01:00 AM
pasting into merged cells with a macro anyanka Excel Programming 2 February 27th 04 10:43 PM
Protecting merged cells Lee Excel Programming 0 October 4th 03 01:31 PM


All times are GMT +1. The time now is 01:53 PM.

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"