Color Fill every 2nd row

Closed
picajol - Nov 6, 2009 at 04:46 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 8, 2009 at 08:01 PM
Hello,
Is it possible to first select a range of rows and then somehow apply a color fill to every odd/even row?
Thanx in advance,.
Is there maybe a plugin for execel that will do something like this automaticly maybe even brig some more decorative option to Excel?
Thanx :-)
Related:

2 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Nov 8, 2009 at 08:01 PM
hit ALT+f11
you will get vbeditor. there will be two windows side by side.
if there is only one window hit control+R.
the left hand side is called
pr0ject-VBA project
and right hand side window may be not blank or blank except for some headings.
on the left hand side window find your file name,keep the cursor on(highlighst) the name of the file and click insert(menu)-module(the menu in the vb editor) . The right hand side window will be now blankIn that blank window
copy paste this macro .

now go to the sheet click tools(menu)-macro-macros. you will get the list of macros in all the open workbooks. In the "Macro" window you see "Macro in" at the bottom.
next a small window is there. on the extreme right side of this small window is a tiny arrow. click that arrow and choose "thisworkbook". You will see your macro ,in this case "test".highlight this macro "test". on the right side of this Macro window you will series of buttons like Run,cancel,step info etc. You click "Run". the macro is invoked and you get what you want. I hope my above instructions are clear.

to understand macros see this web page

https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1<mpl=default<mplcache=2&emr=1&osid=1#all/124d39e53f89a618

save this somewhere so that it will be useful
1
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Nov 6, 2009 at 07:49 PM
This macro will color odd rows. if you want to color even rows change in the macro
if c.row mod 2 =1
into
if c.row mod 2=0

Sub test()
Dim r As Range, c As Range
Worksheets("sheet1").Activate
ActiveSheet.Cells.Interior.ColorIndex = xlNone
Set r = Range(Range("A1"), Range("A1").End(xlDown))
For Each c In r
If c.Row Mod 2 = 1 Then c.EntireRow.Interior.ColorIndex = 6
Next c
End Sub
0
Hey Thanx!
But I have a problem, can you tell me hoe to run this macro?
I dont know anything aboth macros in Excel :-(
Thanx in advance!
0