+ Reply to Thread
Results 1 to 4 of 4

Protecting merged cells via Macro

  1. #1
    Shane in Canberra
    Guest

    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. #2

    Re: Protecting merged cells via Macro

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


  3. #3
    Ken Johnson
    Guest

    Re: 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. #4
    Ken Johnson
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1