+ Reply to Thread
Results 1 to 4 of 4

Loop through worksheets and apply conditional formatting

  1. #1
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Angry Loop through worksheets and apply conditional formatting

    Hi All,

    I am trying to loop through a workbook and apply conditional formatting based on data in Sheet 2 in my workbook, to sheets displaying data imported from csv files.

    The issue I am having is, the conditional formatting is applied to one sheet multiple times, x1 for each of the worksheets in my workbook. I can't seem to work out how to fix it, I have looked at a lot of posts and I seem to be doing what others are.

    The loop seems to work as the MsgBox I have added lists the sheets in the workbook, but only applies the conditonal formatting to the sheet the macro is run from.

    One final though, is it possible to exclude say sheet 1 and sheet 2 from the loop?

    Here's the code I have:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

    Any help would be great!

    Thank you.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Loop through worksheets and apply conditional formatting

    Maybe:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Loop through worksheets and apply conditional formatting

    Hi John,
    Thank you very much for your reply. I have tested it out this morning, thank you for showing me how to set the range, rather than using selection. However the problem still presists. The conditional formatting is all applied to the sheet from which the code is run, so in my test book 4 times, and is not aplied to any of the other sheets in my workbook. Any ideas?

    Thanks you!

  4. #4
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Loop through worksheets and apply conditional formatting

    Hi John & All,
    I managed to fix what was going on, with a For Loop. Here is the code, for anyone else who may get stuck on this.
    (As a note, the code also skips the first sheet)

    Please Login or Register  to view this content.
    Thank you for the help, set me on the right track.

+ 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] How to Apply Conditional Formatting Here
    By mfhaq77 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-23-2016, 11:55 AM
  2. Loop to Match Criteria on Two Sheets and Apply Conditional Format
    By flindy87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2013, 04:06 AM
  3. [SOLVED] Loop and apply formatting
    By apunc1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2013, 12:45 PM
  4. [SOLVED] Loop and apply conditional formats through a range row by row
    By BeachRock in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-11-2012, 11:57 PM
  5. Replies: 1
    Last Post: 11-12-2010, 03:18 PM
  6. Apply same formatting to all worksheets in a workbook
    By capnhud in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2010, 12:23 PM
  7. Replies: 2
    Last Post: 09-02-2009, 07:46 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