Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Coloring Alternate lines

I want to color columns A to E on every other line.
I can't find an ISEVEN or ISINTEGER function, so how do I do That in VB?

Thanks,
Jim Berglund
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Coloring Alternate lines

I'm getting a Next without For error in the following code, and can't figure
out why...
BTW, If I get this fixed, will this code work for coloring alternate lines?
Jim


Sub SortAndColor()
Dim q, i As Long


With ActiveSheet
.Rows("1:1").Delete Shift:=xlUp
q = .Range("A" & Rows.Count).End(xlUp).Row
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=Range("E1:E" & q),
SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
.Sort.SortFields.Add Key:=Range("C1:C" & q),
SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
.Sort
.SetRange Range("A1:E" & q)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply


For i = 1 To q
If Int(i / 2) Then
.Range(Cells(i, 1), Cells(i, 5)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -4.99893185216834E-02
.PatternTintAndShade = 0
End With
Next

.PageSetup.PrintArea = "$A:$E"

End With

End Sub

"Jim Berglund" wrote in message
...
I want to color columns A to E on every other line.
I can't find an ISEVEN or ISINTEGER function, so how do I do That in VB?
Thanks,
Jim Berglund


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Coloring Alternate lines

"Jim Berglund" je napisao u poruci interesnoj
...
BTW, If I get this fixed, will this code work for coloring alternate
lines?
For i = 1 To q


.Range(Cells(i, 1), Cells(i, 5)).Select
With Selection.Interior


for i=1 to q step 2
will affect every-second-row [even or odd, depending on starting used]

you don't need range-select-with-selection, you may shortly:
with .Range(Cells(i, 1), Cells(i, 5)).interior



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Coloring Alternate lines

Thanks very much. I didn't even think of that!
Jim

"sali" wrote in message
...
"Jim Berglund" je napisao u poruci interesnoj
...
BTW, If I get this fixed, will this code work for coloring alternate
lines?
For i = 1 To q


.Range(Cells(i, 1), Cells(i, 5)).Select
With Selection.Interior


for i=1 to q step 2
will affect every-second-row [even or odd, depending on starting used]

you don't need range-select-with-selection, you may shortly:
with .Range(Cells(i, 1), Cells(i, 5)).interior



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
Alternate Row Coloring Ned Excel Discussion (Misc queries) 7 January 15th 10 01:23 PM
Sub to copy only result lines within formula range, omit null string lines Max Excel Programming 2 July 15th 07 04:21 AM
Alternate Color Lines when using Custom Views GLT Excel Discussion (Misc queries) 7 November 13th 05 02:49 PM
Shade alternate lines wyattf Excel Discussion (Misc queries) 3 December 16th 04 07:03 PM
Alternate row coloring David Turner Excel Programming 10 November 8th 03 02:59 AM


All times are GMT +1. The time now is 06:33 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"