+ Reply to Thread
Results 1 to 14 of 14

choosing nth row and add color

  1. #1
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    choosing nth row and add color

    Found a biece of code that works for its purpose however what I need it to do is if a hightlighted range is selected (example 10) then every 10th row it will fill in with a color. Possibly count based off of a number from a different cell.

    Please Login or Register  to view this content.
    Last edited by sunshine076; 08-01-2011 at 01:34 PM.

  2. #2
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: choosing nth row and add color

    Hi, Give this a try?

    This high lights the selected row yellow and makes every 10th row blue.
    Goes in the worksheet code of the worksheet.
    I put a 100 row limit on, but you can change as needed.


    Please Login or Register  to view this content.
    Thank You, Mike

    Some Helpful Hints:

    1. New members please read & follow the Forum Rules
    2. Use Code Tags...Place[code]Before the first line and[/code] After the last line.
    3. If you are pleased with a solution mark your post SOLVED.
    4. Thank those who have help you by clicking the scales at the top right of the post.

    Here...

  3. #3
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: choosing nth row and add color

    What if I want this to start on a specific number of a row such as 14 I would change the target to 14 instead of 1? How would I do individual columns? instead of entire row? It is possible that each column may have a different number to highllight. Example Column A value for cell A2 is 10 it would start on cell 14 column B would be B2 value 5 it would change for every 5th and so on. and need to be able to add data into rows if necessary
    Last edited by sunshine076; 07-19-2011 at 01:36 PM.

  4. #4
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: choosing nth row and add color

    Ok here is another version that works off the cells in a column.

    This example uses columns A,B and C

    If you select a cell in column A2 down it will highlight that cell in yellow then look at cell A1 to see how many rows down it should highlight the rest of the cells in blue

    Same with B and C Again 100 is the max so if your data goes further you will need to adjust the max row.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: choosing nth row and add color

    It isn't allowing me to enter in any data into any cells it keeps flipping.

  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: choosing nth row and add color

    Ok, See how this works.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: choosing nth row and add color

    It errors out when I enter in a number in cell A1 and goes to this line:
    Please Login or Register  to view this content.
    Sub or function not defined

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: choosing nth row and add color

    or
    Please Login or Register  to view this content.



  9. #9
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: choosing nth row and add color

    snb
    I do see your's somewhat working however it doesn't count every 10th line.

  10. #10
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: choosing nth row and add color

    Just curious if you may have forgot to place this in the last code I gave you?

    Please Login or Register  to view this content.

  11. #11
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: choosing nth row and add color

    You're mistaken: it does.
    But maybe you have something else in mind

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: choosing nth row and add color

    I'll give it a try again and let you know.

  13. #13
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: choosing nth row and add color

    Why does the columns with the highlighted color move down once a value has been added? Is this issue that I am having have something to do with excel 2003? Otherwise it does do what it should but I need the column coloring to stay put without moving and allow a value to be entered into a highlighted box without shifting anything or does it move once a value has been entered into the specific cell?.
    Last edited by sunshine076; 07-21-2011 at 10:35 AM.

  14. #14
    Registered User
    Join Date
    07-30-2010
    Location
    Wixom, Mi
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: choosing nth row and add color

    Realniceguy5000 I see how your code works now is there a way to have this affect all columns instead of individual?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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