+ Reply to Thread
Results 1 to 4 of 4

Color Index VBA stops working after save and closure

  1. #1
    Registered User
    Join Date
    05-24-2021
    Location
    Dallas
    MS-Off Ver
    Excel 2013 Windows & 2021 Excel for Mac
    Posts
    3

    Exclamation Color Index VBA stops working after save and closure

    Hello -

    I usually don't do forums, but at this point I'm desperate. I'm working on a project at work. The WorkBook has several tabs. The only VBA functions/sub functions I'm using are the

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

    Then also the Private Sub Function of Worksheet_SelectionChange.

    The issue:

    Yesterday after spending hours I figured out how to use a combination of the ColorIndex VBA and a ghost sheet to identify the colors of specific cells using an Index Match formula. Then I was on my way to throwing on the conditional formatting so that when a cell is highlighted on any other sheet (in work's case yellow) it will also transfer to the "Master sheet" where we can pull the information of 1 individual across all the sheets into 1 view. (Hence the Index Match)

    It worked beautifully yesterday. I saved and closed with the intent of finishing the conditional formatting (Using the ColorIndex(range)=6 type formula.. that's not the whole thing but basically) that worked yesterday. Now the ColorIndex VBA won't work and returns a #Name? error. I have not touched anything on the VBA or the ColorIndex formula on the dummy sheet. I solely was applying the Conditional Formatting to the master sheet.

    So I started over, only to find that this ColorIndex VBA at its basic application will again, stop working once the sheet is saved and closed and reopened.

    Can ANYONE point me in the direction of why this is happening and how to get it to stop?

    *Please note: all this VBA stuff I spewed above I learned in about a week, so my understanding is fairly limited... Explain it like a toddler to me lol*

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Color Index VBA stops working after save and closure

    A NAME error for a VBA function generally means that either macros are not enabled, or the code is in a workbook that isn't open, or the code module that the code is in has the same name as the function.
    Rory

  3. #3
    Registered User
    Join Date
    05-24-2021
    Location
    Dallas
    MS-Off Ver
    Excel 2013 Windows & 2021 Excel for Mac
    Posts
    3

    Re: Color Index VBA stops working after save and closure

    Yes, so I did just close out all other books and start ALL OVER with a raw ColorIndex function and random information to get it to work.

    Here's the thing. I followed instructions for the "enable macro" thing, and it's grayed out on my Excel. Now a co-worker did a function very similar to this (this has been a year long project that is basically recycled every quarter, and now I own it) and it has worked every time. We work at the same place so I'd assume the macro settings are the same for both of us. When I got the options, the only macro function I can change is "Trust VBA project object model"

    Will that not be enough? Is this more of a "Hey tech, let me enable my macros" type situation?

    Thank you in advance.

  4. #4
    Registered User
    Join Date
    05-24-2021
    Location
    Dallas
    MS-Off Ver
    Excel 2013 Windows & 2021 Excel for Mac
    Posts
    3

    Thumbs up Re: Color Index VBA stops working after save and closure

    Got a fix... Turns out my job automatically disables macros unless the file is saved on a secure drive and I didn't know that. Thank you for your help!

+ 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. Super simple save as .pdf macro stops working from time to time, then works again
    By erpokorp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2019, 10:10 AM
  2. Add in stops working
    By orourkcp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-16-2015, 11:10 AM
  3. Working While Statement Stops Working
    By Verbaruab in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2011, 05:58 PM
  4. Workbook is reopening after save and closure by a macro
    By SuperChris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2010, 12:37 PM
  5. Macro to run on save or closure of workbook
    By cmb80 in forum Excel General
    Replies: 2
    Last Post: 05-05-2009, 06:53 AM
  6. [SOLVED] Excel stops responding while trying to save or save as
    By MADMEX58 in forum Excel General
    Replies: 0
    Last Post: 05-12-2006, 04:30 PM
  7. VBA Stops Working?
    By Marty in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2005, 01:32 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