+ Reply to Thread
Results 1 to 4 of 4

MergeCells & Run-time error '1004' - Unable to set the Hidden property of the Range class

  1. #1
    Registered User
    Join Date
    04-16-2020
    Location
    Grand Rapids, MI
    MS-Off Ver
    15.0.5215.1000
    Posts
    12

    MergeCells & Run-time error '1004' - Unable to set the Hidden property of the Range class

    Hello,

    I recently added the below merge function to an excel sheet that already had code. Everything in the sheet works fine until I run the Merge macro. I have several formulas throughout the sheet, so it needs to be password protected. Once I run the merge function, the sheet loses its ability to automatically hide and unhide rows. I have tried moving ActiveSheet.Protect to the end of Worksheet_Change and have also tried moving the entire Merge function to the very end of the code. Does anyone have a fix for this? Thanks for your time!


    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: MergeCells & Run-time error '1004' - Unable to set the Hidden property of the Range cl

    When you protect the sheet, you have options that you can choose.

    When you protect the sheet in your code, you are not selecting the options you need/had.

    Record a macro while you protect the sheet with the options you need. Then copy the recorded code to your Merge macro.

    That said, merged cells are a PitA and to be avoided like the plague. They can screw up your Change and Selection Event handlers as, if you change a merged cell, the cell count is increased.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    04-16-2020
    Location
    Grand Rapids, MI
    MS-Off Ver
    15.0.5215.1000
    Posts
    12

    Re: MergeCells & Run-time error '1004' - Unable to set the Hidden property of the Range cl

    Thank you! That worked! I agree that merged cells can cause a lot of problems. This form is used quite often at my workplace over multiple employees. Luckily, we have an ERP system that will allow us to have access to previous versions of the files if the merged cells ever work against us. Again, thank you for your help!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: MergeCells & Run-time error '1004' - Unable to set the Hidden property of the Range cl

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run time error 1004 - Unable to set the hidden property of the range class
    By excelconditional in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-16-2018, 12:09 PM
  2. Run-time error '1004': Unable to set the hidden property of the range class
    By lovekush in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-10-2017, 05:29 AM
  3. [SOLVED] Run-time error '1004' - Unable to set the Hidden property of the Range class
    By redoscar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-04-2017, 09:34 AM
  4. run time error 1004 unable to set the hidden property of the worksheet class
    By curness in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2015, 05:41 PM
  5. [SOLVED] Run time error 1004: Unable to set hidden property of range class
    By SAVIOBLUEFOX in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2013, 10:38 AM
  6. Help Please w/ Run-time error '1004' Unable to set the Hidden property of the Range Class
    By ExcelNewbie2534 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2012, 07:38 PM
  7. Run-time error 1004: Unable to set the hidden property of the Range class.
    By seabee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2011, 05:09 PM

Tags for this Thread

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