+ Reply to Thread
Results 1 to 3 of 3

Macro/VBA to select a set of rows and then highlight them in a color?

  1. #1
    Registered User
    Join Date
    06-30-2010
    Location
    Newport New VA
    MS-Off Ver
    Excel 2003
    Posts
    97

    Macro/VBA to select a set of rows and then highlight them in a color?

    I am working on a project to automate some steps. What I cant figure out is the following.
    1. How to create a macro that will select a group of rows, and the number of rows can change each time. Will select these rows and then highlight them in Blue.
    2. After highlighting these rows it will then find the last row, and insert 5 blank rows between the last row of highlight rows and non highlight rows.

    So I have in column A a set of row that either have a 1 in them or 0. they are sorted with all row of 1 together and all rows of 0 together. The number of rows that will start with the number 1 can change each time, so I need a macro/vba that will find all rows in column A that start with 1. and then highlight the entire set of rows in the color blue.

    Next it will then find that last row of 1, and the first row of 0 and insert 5 blank rows.

    Thanks for your help.. I tried to record a macro only to find out that it will do all these things on the exact same number of rows as was recorded..so that wont do since the number of rows could change... Also found out that the conditional formating does not work as a macro..so need to create vba code that can do it..

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro/VBA to select a set of rows and then highlight them in a color?

    here is a quick and dirty way to do this....

    Please Login or Register  to view this content.
    Record macro is really cool, you have to learn how to make it dynamic after you record it....this might help....
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Macro/VBA to select a set of rows and then highlight them in a color?

    Or as an alternative, you could try this.

    Please Login or Register  to view this content.

+ 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] Macro Highlight & select different value in multiple range
    By feroguz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-18-2012, 12:05 PM
  2. [SOLVED] Select Rows Based On Row Color
    By nrichardson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-25-2012, 11:54 AM
  3. macro line - highlight the last row to color green according to col A
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2011, 06:40 PM
  4. Macro to color highlight dates in certain range. Please help.
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-29-2011, 09:55 AM
  5. can you select rows in excel with a certain background color?
    By stelee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 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