From: andreas on
Dear Experts:

With any number of rows SELECTED in a table I would like to apply
alternate (grey/red) shading.

Grey: RGB (242, 242, 242)
Red: RGB (239, 211, 210)

How can this be achieved using VBA?

Help is much appreciated.

Thank you very much in advance.

Regards, Andreas
From: Graham Mayor on
You are not trying now ;)
This is almost the same as the question you asked earlier in the week


Dim i As Long
Dim oRow As Row
i = 1
For Each oRow In Selection.Range.Rows
If i Mod 2 = 0 Then
oRow.Shading.BackgroundPatternColor = RGB(242, 242, 242)
Else
oRow.Shading.BackgroundPatternColor = RGB(239, 211, 210)
End If
i = i + 1
Next


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"andreas" <andreas.hermle(a)gmx.de> wrote in message
news:f16a68c4-b04e-4c09-870f-a7d6c21a489b(a)l26g2000yqd.googlegroups.com...
> Dear Experts:
>
> With any number of rows SELECTED in a table I would like to apply
> alternate (grey/red) shading.
>
> Grey: RGB (242, 242, 242)
> Red: RGB (239, 211, 210)
>
> How can this be achieved using VBA?
>
> Help is much appreciated.
>
> Thank you very much in advance.
>
> Regards, Andreas


From: andreas on
On Feb 19, 2:48 pm, "Graham Mayor" <gma...(a)REMOVETHISmvps.org> wrote:
> You are not trying now ;)
> This is almost the same as the question you asked earlier in the week
>
> Dim i As Long
> Dim oRow As Row
> i = 1
> For Each oRow In Selection.Range.Rows
>     If i Mod 2 = 0 Then
>         oRow.Shading.BackgroundPatternColor = RGB(242, 242, 242)
>     Else
>         oRow.Shading.BackgroundPatternColor = RGB(239, 211, 210)
>     End If
>    i = i + 1
> Next
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor -  Word MVP
>
> My web sitewww.gmayor.com
> Word MVP web sitehttp://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> "andreas" <andreas.her...(a)gmx.de> wrote in message
>
> news:f16a68c4-b04e-4c09-870f-a7d6c21a489b(a)l26g2000yqd.googlegroups.com...
>
>
>
> > Dear Experts:
>
> > With any number of rows SELECTED in a table I would like to apply
> > alternate (grey/red) shading.
>
> > Grey: RGB (242, 242, 242)
> > Red: RGB (239, 211, 210)
>
> > How can this be achieved using VBA?
>
> > Help is much appreciated.
>
> > Thank you very much in advance.
>
> > Regards, Andreas- Hide quoted text -
>
> - Show quoted text -

Hi Graham,

thank you very much for your terrific help. It works as desired.

Graham, you are right, it is almost the same question as the one from
last week. The one from last week was about paragraph shading, this
one is about table shading.

Again, thank you very much for your superb help. I really appreciate
it. I turned to your website a couple of weeks ago for mail merge
advice including graphics. You saved my day with the tips.
Superb tutorial on this matter. The best I could find so far.

Regards from Germany, Andreas