Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Identify even (or odd) rows without toolpak and 'ISEVEN'/'ISODD' ?

Hi,

I intend to have every even or odd row in another color, using
=iseven(row()) as conditionformat. However, i've learned that ISEVEN
demand the add-in Analysis Toolpak and I don't want that (of different
reasons).

Therefore - can someone find out a way to identify even or odd rows
without iseven/isodd function?

I can't have supporting cells on columns to the right becauser users
can add rows and if so, i can't build it on referring to other cells.

Happy to all suggestions,
Regards
tskogstrom

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Identify even (or odd) rows without toolpak and 'ISEVEN'/'ISODD' ?

Bob Phillips offered this website for a similar question.
http://www.xldynamic.com/source/xld.CF.html#rows


Also, Carlo offered this solution in the same thread.
This colors the uneven rows.

Sub test()

For Each row_In Selection.Rows
If row_.Row() Mod 2 = 1 Then
row.Interior.ColorIndex = 35
End If
Next row_

End Sub

--
Pops Jackson


"tskogstrom" wrote:

Hi,

I intend to have every even or odd row in another color, using
=iseven(row()) as conditionformat. However, i've learned that ISEVEN
demand the add-in Analysis Toolpak and I don't want that (of different
reasons).

Therefore - can someone find out a way to identify even or odd rows
without iseven/isodd function?

I can't have supporting cells on columns to the right becauser users
can add rows and if so, i can't build it on referring to other cells.

Happy to all suggestions,
Regards
tskogstrom


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Identify even (or odd) rows without toolpak and 'ISEVEN'/'ISODD' ?

Hi tskogstrom

Try http://www.cpearson.com/excel/banding.htm

or below, please

Option Explicit

'----------------------------------------------------------
' Procedure : mark2row
' Date : 20031002
' Author : Joergen Bondesen
' Purpose : Highlight every 2end row.
' Note : Avoid hidden row(s)
'----------------------------------------------------------
'
Sub mark2row()
Dim lastrow As Long
Dim cell As Variant
Dim Counter As Long

'// Macro
DeleteLastEmptyRows

lastrow = ActiveSheet.UsedRange.Rows _
(ActiveSheet.UsedRange.Rows.Count).Row

Range("A1:A" & lastrow).EntireRow.Interior.ColorIndex = _
xlColorIndexNone

For Each cell In Range("A1:A" & lastrow)

If Not cell.Rows.Hidden = True Then

Counter = Counter + 1

If Counter Mod 2 = 0 Then
'// Yellow
Range(cell.Address).EntireRow.Interior _
.ColorIndex = 6
End If
End If
Next cell

End Sub


Sub DeleteLastEmptyRows()
Dim lastrow As Long
Dim r As Long
Dim xx As Long

lastrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count

Application.ScreenUpdating = False

For r = lastrow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
If Application.CountA(Rows(r)) < 0 Then Exit Sub
Next r

xx = ActiveSheet.UsedRange.Rows.Count
End Sub


--
Best regards
Joergen Bondesen


"tskogstrom" wrote in message
oups.com...
Hi,

I intend to have every even or odd row in another color, using
=iseven(row()) as conditionformat. However, i've learned that ISEVEN
demand the add-in Analysis Toolpak and I don't want that (of different
reasons).

Therefore - can someone find out a way to identify even or odd rows
without iseven/isodd function?

I can't have supporting cells on columns to the right becauser users
can add rows and if so, i can't build it on referring to other cells.

Happy to all suggestions,
Regards
tskogstrom



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Identify even (or odd) rows without toolpak and 'ISEVEN'/'ISODD' ?

Hi,

Thank you both for your efforts, but I found out I can use MOD
function. Formatcondition used:
IF(MOD(RIGHT(TRUNC(A1,0)),2),MOD(RIGHT(TRUNC(A1,0) ),2*)
)=1

Kind regards
tskogstrom



Joergen Bondesen skrev:

Hi tskogstrom

Try http://www.cpearson.com/excel/banding.htm

or below, please

Option Explicit

'----------------------------------------------------------
' Procedure : mark2row
' Date : 20031002
' Author : Joergen Bondesen
' Purpose : Highlight every 2end row.
' Note : Avoid hidden row(s)
'----------------------------------------------------------
'
Sub mark2row()
Dim lastrow As Long
Dim cell As Variant
Dim Counter As Long

'// Macro
DeleteLastEmptyRows

lastrow = ActiveSheet.UsedRange.Rows _
(ActiveSheet.UsedRange.Rows.Count).Row

Range("A1:A" & lastrow).EntireRow.Interior.ColorIndex = _
xlColorIndexNone

For Each cell In Range("A1:A" & lastrow)

If Not cell.Rows.Hidden = True Then

Counter = Counter + 1

If Counter Mod 2 = 0 Then
'// Yellow
Range(cell.Address).EntireRow.Interior _
.ColorIndex = 6
End If
End If
Next cell

End Sub


Sub DeleteLastEmptyRows()
Dim lastrow As Long
Dim r As Long
Dim xx As Long

lastrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count

Application.ScreenUpdating = False

For r = lastrow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
If Application.CountA(Rows(r)) < 0 Then Exit Sub
Next r

xx = ActiveSheet.UsedRange.Rows.Count
End Sub


--
Best regards
Joergen Bondesen


"tskogstrom" wrote in message
oups.com...
Hi,

I intend to have every even or odd row in another color, using
=iseven(row()) as conditionformat. However, i've learned that ISEVEN
demand the add-in Analysis Toolpak and I don't want that (of different
reasons).

Therefore - can someone find out a way to identify even or odd rows
without iseven/isodd function?

I can't have supporting cells on columns to the right becauser users
can add rows and if so, i can't build it on referring to other cells.

Happy to all suggestions,
Regards
tskogstrom


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
conditional formating with isodd and iseven BIG D Excel Worksheet Functions 14 November 21st 07 05:10 PM
ISODD and EVEN formula BSantos Excel Worksheet Functions 6 January 18th 06 04:28 PM
cannot use ISEVEN or ISODD functions in Conditional Formatting Scott Paine Excel Worksheet Functions 6 December 6th 05 09:44 PM
ISEVEN SimonW Excel Worksheet Functions 4 March 26th 05 05:01 PM
IF and ISODD Formula Help vgolfman Excel Worksheet Functions 2 October 28th 04 03:07 PM


All times are GMT +1. The time now is 08:53 AM.

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"