Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Color every second row ?


I have written a small macro using CurrentRegion where in VBA detects
last column and last row in used area and only shades that range. I
also color header row differently. I strongly recommend that you store
this procedure or your own procedure in VBA project module and create a
custom button in a toolbar associated with this procedure. All that you
have to do is select any cell in the table and click this button it.
The procedure I wrote and use is ( I call it EasyRead named after
continuous stationery used for computer printouts )

Sub EasyRead()
Dim MyArea As Object
Set MyArea = ActiveCell.CurrentRegion
ColNum = MyArea.Columns.Count
RowNum = MyArea.Rows.Count
FirstCol = MyArea.Column
FirstRow = MyArea.Row

OddFlag = True
With Range(Cells(FirstRow, FirstCol), Cells(FirstRow, FirstCol +
ColNum - 1))
..Interior.ColorIndex = 40
..Font.Bold = True
End With
For i = 1 To RowNum - 1
Set NewRow = Range(Cells(FirstRow + i, FirstCol), Cells(FirstRow +
i, FirstCol + ColNum - 1))
If OddFlag = True Then
NewRow.Interior.ColorIndex = 2
Else
NewRow.Interior.ColorIndex = 20
End If
OddFlag = Not (OddFlag)
Next i
With MyArea.Borders
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With

End Sub


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=503235

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint / Excel: custom pp RGB color doesn't match identical Excelcustom RGB color mikewillnot Charts and Charting in Excel 1 February 26th 08 05:22 PM
Can't format cell color/text color in Office Excel 2003 in fil Tony S Excel Discussion (Misc queries) 1 December 21st 07 01:41 PM
Can't format cell color/text color in Office Excel 2003 in files . albertaman Excel Discussion (Misc queries) 0 February 16th 06 03:56 AM
My fill color and font color do not work in Excel Std Edition 2003 chapstick Excel Discussion (Misc queries) 1 September 11th 05 08:48 PM
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


All times are GMT +1. The time now is 03:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"