You are a hero! Works perfectly. Let this code replace the 400 other,
more complicated examples of code I found that attempt to do the same
thing.

On Jul 1, 2:34 am, Stuart Redmann <dertop...@web.de> wrote:
> On 30 Jun. Kurt wrote:
>
> > > > 1. The comment in this code has as an example, "ShadeAlternateRows
> > > > Range("A1:D50"), 27, 2", but where in the actual code do you put this
> > > > information?
> Stuart Redmann wrote:
> > > That depends on when the highlighting should happen.
> Kurt wrote:
> > I'm most interested in learning how to do it manually (e.g., after
> > manually selecting a range).
>
> Ok. First of all, you can only use subs that take no arguments (and
> then it does not matter where you put it). The macro must be re-
> designed to use the current selection (also we have to fix the step
> width and the color):
>
> Public Sub ShadeAlternateRows()
>   With Selection
>         ' remove any previous shading
>         .Interior.ColorIndex = xlColorIndexNone
>
>         ' Shade every second row in yellow (= color index 27)
>         Dim r As Long
>         For r = 2 To .Rows.Count Step 2
>            .Rows(r).Interior.ColorIndex = 27
>         Next r
>     End With
> End Sub
>
> Now you this sub appears in the macro list and can be assigned a
> shortcut. If you need to be able to use different colors, you'll have
> to pop up a dialog that lets the user choose a color.
>
> Regards,
> Stuart

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to