LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default loop variable range

Dave Thank you
It does exactly what I wanted.

What is the best way to check for illegal values? ie if either or both of
the two summed cells have a value of 0, I would want to skip to the next
icol

CR



"Dave Peterson" wrote in message
...
Dim iCol as long
dim FirstCol as long
dim LastCol as long

with worksheets("Somesheetnamehere")
firstcol = .range("d1").column
lastcol = .range("s1").column

for icol = firstcol to lastcol
'no check for illegal values!
if (.cells(3,icol).value + .cells(5,icol).value) _
.cells(1,icol).value then

'do something
else
'do nothing
end if
next icol
end with

Untested, uncompiled. Watch for typos.

CR wrote:

I have a Range with values D1:S5

I need to sum D3 and D5 and if it is D1 value then
Do something

Then loop through E to S, doing the same thing

Any help would be appreciated

Thanks
CR


--

Dave Peterson



 
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
loop variable range Jim Thomlinson Excel Programming 0 September 21st 09 04:28 PM
loop variable range Jim Thomlinson Excel Programming 0 September 21st 09 04:27 PM
loop variable range Dave Peterson Excel Programming 0 September 21st 09 04:24 PM
Referencing variable Range in a loop Samirkc Excel Programming 2 July 14th 06 12:49 PM
How to reference variable range in a loop Samirkc Excel Programming 0 July 13th 06 04:11 PM


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

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"