Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default generate Odd row numbers in VBA

I want to add cells with odd row numbers in a column.
How can I generate odd row numbers in VBA?
--
Rasoul Khoshravan Azar
Kobe University, Kobe, Japan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default generate Odd row numbers in VBA

Why a formula like =SUMPRODUCT(A1:A11,MOD(ROW(A1:A11),2)) which will add the
cells A1, A3, A5, A7, A9 and A11?

If you want to do it in VBA, use a loop with a step equals to 2:
Total = 0
For iRow = 1 To 11 Step 2
Total = Total + Cells(iRow, 1)
Next iRow
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
Generate random numbers cawhitaker Excel Discussion (Misc queries) 3 September 27th 07 09:01 PM
generate numbers Pammy Excel Discussion (Misc queries) 3 September 19th 07 08:20 PM
How to generate #'s that excludes certain numbers? dojistar Excel Worksheet Functions 2 November 15th 05 06:52 PM
Generate new account numbers? Alan New Users to Excel 2 October 5th 05 09:15 PM
Generate consecutive numbers alexcooper2003 Excel Worksheet Functions 1 November 22nd 04 02:37 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"