Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Amersfoort, Utrecht, Netherlands
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel Macro to color my rows (97)

    Hello All,

    I'm looking for a macro that will do the following:
    * Starting form the current row
    * color this row light yellow
    * go to next row
    * color this row white
    * go to next row
    * color this row light yellow
    * go to next row
    * ..... until the last row that contains data

    Someone an idea?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Macro to color my rows (97)

    You can do this without coding using Conditional Formatting, or you can set the conditional formatting in code. See the thread starting at <post#=27808>post 27808</post#> for ideas about this. The methods described there do not exactly do what you want, but it is not hard to adapt them to your needs.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Amersfoort, Utrecht, Netherlands
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Macro to color my rows (97)

    Yes Hans,

    Thanks. Sometimes it is so easy

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Perth, Western Australia, Australia
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Macro to color my rows (97)

    There is an addtional conditional formatting method that will colour alternate rows, and allow automatically for hidden/filtered rows.

    Use a construct like:
    =MOD(SUBTOTAL(3," & sStart & ":" & sRelative & " )," & sBand & " )=0

    where

    sStart is the absolute address of the of the range to be coloured.
    sRelative is the relative address of the range to be coloured.
    sBand is the number of rows between colouring.

    eg for colouring a2:g10 evey second row green use

    =MOD(SUBTOTAL(3,$A$2:$G10 ),2 )=0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •