+ Reply to Thread
Results 1 to 7 of 7

Macro failing at conditional formatting font colour

  1. #1
    Registered User
    Join Date
    11-04-2013
    Location
    UK
    MS-Off Ver
    2016 (Office 365 Business Premium)
    Posts
    7

    Post Macro failing at conditional formatting font colour

    Hi there,

    I've recorded a macro in Excel 2007 which opens a file then highlights columns I to CH, then applies conditional formatting so that if a cell has a value of <0, it applies a red font with pink fill colour. Here's the code:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The problem is, when I run it, it fails and hitting debug takes me to the below lines, highlighted.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If anyone could point me in the right direction it would be greatly appreciated.
    Last edited by RC-AMG; 01-12-2015 at 12:28 PM. Reason: Solved.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Macro failing at conditional formatting font colour

    Try this:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    11-04-2013
    Location
    UK
    MS-Off Ver
    2016 (Office 365 Business Premium)
    Posts
    7

    Re: Macro failing at conditional formatting font colour

    Thanks for the quick reply! Unfortunately this gives me the same kind of error, Run-time '1004'/Application-defined or object-defined error, highlighting the row beginning '.colour' at this point:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I ran a repair install of Office 2007, just in case, but still no joy.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Macro failing at conditional formatting font colour

    A couple of questions:
    1. Is the worksheet protected in any way?
    2. Do you have at least SP2 installed on your Office 2007?

  5. #5
    Registered User
    Join Date
    11-04-2013
    Location
    UK
    MS-Off Ver
    2016 (Office 365 Business Premium)
    Posts
    7

    Re: Macro failing at conditional formatting font colour

    1. No protection
    2. Service Pack 3

    Cheers.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Macro failing at conditional formatting font colour

    I can't see why it wouldn't work then - it works fine in 2010 (using your original code also). Can you post a sample workbook that it fails on? (no data necessary)

    Noting that your workbook is in xls format, I assume you are aware that since an xls file colour palette can only use 56 colours, you may not get the exact colour you specify.

  7. #7
    Registered User
    Join Date
    11-04-2013
    Location
    UK
    MS-Off Ver
    2016 (Office 365 Business Premium)
    Posts
    7

    Re: Macro failing at conditional formatting font colour

    I've uninstalled 2007 and moved to 2013, and it runs fine; like you mentioned with 2010. Very odd. Oh well, thanks! And thanks for the info re XLS colour palette.

+ 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] Conditional colour formatting without seeing the font used for the condition.
    By kristyhutt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-18-2013, 01:07 AM
  2. Replies: 1
    Last Post: 09-12-2013, 02:09 PM
  3. Replies: 15
    Last Post: 05-31-2012, 10:34 AM
  4. Replies: 2
    Last Post: 10-03-2009, 05:01 PM
  5. Replies: 9
    Last Post: 10-22-2007, 07:29 AM

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