Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Formatting of fields

"JeffH" wrote in message
...
: HI,
:
: Does anyone know if it is possible to programmatically reset an excel
: spreadsheet such that every third and fourth row are a different
background
: color but yet the first two rows are left untouched? I have a user that
is
: trying to format the first two rows with a default background and then the
: third and fourth rows to be formatted with a green-bar background and
: continue on in the spreadsheet using this technique. The problem here is
: that if a row gets added into the spreadsheet, then the user needs to
: reformat everything. I'm thinking that a macro could do it but I'm not
well
: versed in Excel macros.
:
: Thanks in advance,
: JeffH
:

To do this programmatically try

Public Sub RowColor()
Dim c As Range

For Each c In ActiveSheet.Rows
If (c.Row - 1) Mod 4 1 Then
c.Interior.ColorIndex = 10
Else: c.Interior.ColorIndex = xlNone
End If
Next c

End Sub

The above changes all rows which may be too many. To limit the row count
you can dim c as an integer and change the for each line to for c = 1 to
number_of_rows_to_change


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
Formatting Numeric Fields from Within MS Query Paul D. Simon Excel Discussion (Misc queries) 1 January 17th 08 05:16 PM
PivotTables - formatting Row fields when grouped Heidi Excel Discussion (Misc queries) 6 February 2nd 07 07:26 PM
Formatting of fields macropod Excel Programming 0 December 11th 06 11:29 PM
Formatting Fields Naguib Excel Worksheet Functions 1 January 26th 05 06:02 PM
Formatting date fields after export Raymond Excel Discussion (Misc queries) 2 December 1st 04 12:04 AM


All times are GMT +1. The time now is 02:28 PM.

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

About Us

"It's about Microsoft Excel"