+ Reply to Thread
Results 1 to 3 of 3

Macro hides rows on button press but other Functions referenced then display ERROR message

  1. #1
    Registered User
    Join Date
    05-28-2015
    Location
    Cardiff, Wales
    MS-Off Ver
    MS Office 2010
    Posts
    5

    Macro hides rows on button press but other Functions referenced then display ERROR message

    I want to be able to hide and unhide rows containing calculations etc using a macro accessed by a button. I have done this and the rows hide/unhide correctly. However cells in another worksheet, the hidden area and in the visible areas have functions which then return an #VALUE! error. If I hide the rows manually by selecting them and using right-click Hide, the functions continue to work normally.

    The macro is simply:

    sub
    ActiveSheet.Rows("32:85").Hidden=True
    end sub

    and the function is:

    Function ColorIndex(CellColor As Range)
    ColorIndex = CellColor.Interior.ColorIndex
    End Function

    and also

    =IF(AW39>=AW18,"OK","Needs Cover") (this is for the range of columns C:AX)

    and also

    a larger Function called DisplayedColour which returns a value based on the visible colour of a cell.

    I don't understand why the macro should have such an impact on the rest of my spreadsheet. Worst case is I hide the rows manually but it would be nice to have the buttons.

    Any ideas as to where it has all gone wrong??

    Thanks,

    dougielb

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Macro hides rows on button press but other Functions referenced then display ERROR mes

    change
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Last edited by JasperD; 05-29-2015 at 08:03 AM.
    Please click the * below if this helps

  3. #3
    Registered User
    Join Date
    05-28-2015
    Location
    Cardiff, Wales
    MS-Off Ver
    MS Office 2010
    Posts
    5

    Re: Macro hides rows on button press but other Functions referenced then display ERROR mes

    Hi JasperD,

    That's perfect thank you - it does exactly what I was looking for. Just for my knowledge, I assume that the EnableEvents function/trigger(?) fires my other functions into working properly?

    Many thanks again,

    dougielb

+ 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] Select varying quantity of rows, press macro button to send selection to new workbook
    By tv69 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2013, 10:09 AM
  2. Message box when I press Refresh All button.
    By Reykjavik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2013, 09:22 AM
  3. macro button to insert rows - error message
    By seb_vdl in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-16-2013, 11:16 AM
  4. [SOLVED] macro that hides a row referenced in a cell, instead of just the row indicated by the cell
    By susanbarbour in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-13-2012, 03:51 PM
  5. VBA For Error Message If Value is Referenced in Sheet
    By BrownTeddyBear in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2009, 03:20 AM

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