+ Reply to Thread
Results 1 to 4 of 4

Setting height from another worksheet

  1. #1
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Setting height from another worksheet

    Hi all, Im having difficulty trying to resolve my code that randomly generates an error message.

    The aim of the code is to set the row height from a stored number from another worksheet called prefs.
    When the worksheet prefs is password unprotected and cells visible, the code works.
    As soon as I hide the cells and lock the page, the runtime error 91 message appears.
    The line which is flagged up is the line below the on error resume next line.

    Please Login or Register  to view this content.
    Any help is much appreciated.

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Setting height from another worksheet

    Hi sparx,

    Edit: After re-reading your question I noticed that you have your error message before my below assumption. It looks that the error you're getting is due to hidden cells where the Range.Find will not work unless you either unhide the cells, perform your code then re-hide or change your LookIn argument to xlFormula if your data is not formulas in the range

    I have revised your code a little bit. I think the issue could be due to not assigning the Rows("4:33") as highlighted in red below to any sheet takes the active sheet. Try the below code & if you hit the same error message, try to assign the rows to a sheet

    Please Login or Register  to view this content.
    Last edited by nankw83; 07-15-2020 at 03:51 PM.

  3. #3
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Re: Setting height from another worksheet

    Hi nankw83, thank you for your help, I tried your code and assigned the rows as per your instruction.
    The code didn't work but will try again in a bit.

    The strangest thing is, if I keep the cells visible on the prefs sheet even if the worksheet is protected,
    the original error does not show.

    I normally hide cells I dont want people to see but unhid them, put text as size 1, white text so appears invisible,
    and the orogonal code worked.
    I like your way of code, its cleaner and easier to understand so will try to use it.

    Ill let you know the outcome.

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Setting height from another worksheet

    I have made an edit in my first post, just see if it works with xlFormulas

+ 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. [SOLVED] Setting row height the same if it contains a certain text
    By playdoman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2013, 02:11 PM
  2. Setting Row Height
    By admiralpumpkin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2011, 11:33 PM
  3. Setting Row Height Along with Auto Adjust
    By lwolsiffer in forum Excel General
    Replies: 0
    Last Post: 11-03-2010, 04:53 PM
  4. Setting column width and row height
    By meherts in forum Excel General
    Replies: 1
    Last Post: 07-16-2010, 11:05 AM
  5. Setting the Height and Width of an Image
    By NaNaBoo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2009, 01:36 PM
  6. [SOLVED] Need help setting the worksheet header/Footer margins based on string height?
    By Doug in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2006, 12:15 PM
  7. Replies: 0
    Last Post: 08-19-2006, 09:10 PM
  8. Setting row height for all rows
    By anjanesh in forum Excel General
    Replies: 4
    Last Post: 05-05-2006, 02:50 PM

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