Even ODD Row Number Query

gsaini

New Member
Joined
Apr 8, 2011
Messages
15
Hi All, I am able to find out the correct function to work with Even and Odd rows.My small requirement is as below.

z = ActiveCell.row
If z = evern number then
MsgBox("Even row selected")
else
MsgBox("Odd row Selected")

I tried using MOD but Excel doen't like it.

Any Advice? Please
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
The syntax for MOD is slightly different in VBA then it is in a cell formula..

In a formula it would be

=IF(MOD(z,2)=0,"It's Even",It's Odd")


In VBA it's written like

Code:
If z Mod 2 = 0 Then
    Msgbox "It's Even"
Else
    Msgbox "It's Odd"
End If
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,463
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top