Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default For To Next loop

Dear professionals

Does the For ...To .. Next loop have a syntax where I could run 2
different number ranges in the same loop (will illustrate my question by a
fake "code").

For n = 1 To 10 And For n = 21 To 30
... do something
Next n

I guess I could inside the loop, use an IF condition at the beginning and
let the loop ignore part of the numbers, but maybe there is a direct way
also.

-----------------------------------
All the best, and thanks in advance.
Uno Kõrsmaa



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default For To Next loop

Hi Uno,

You asked this two days ago and received a detailed response from JE
McGimpsey:

http://tinyurl.com/3lran

You should stay in the same thread and. if JE's response was inappropriate
to your needs, explained that there.

Otherwise you threads and may well cause respondents to waste time
duplicating replies.

---
Regards,
Norman



"uno@korsmaa" wrote in message
...
Dear professionals

Does the For ...To .. Next loop have a syntax where I could run 2
different number ranges in the same loop (will illustrate my question by a
fake "code").

For n = 1 To 10 And For n = 21 To 30
... do something
Next n

I guess I could inside the loop, use an IF condition at the beginning and
let the loop ignore part of the numbers, but maybe there is a direct way
also.

-----------------------------------
All the best, and thanks in advance.
Uno Kõrsmaa





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default For To Next loop

Otherwise you threads ...

Otherwise you risk fragmenting threads ...

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Uno,

You asked this two days ago and received a detailed response from JE
McGimpsey:

http://tinyurl.com/3lran

You should stay in the same thread and. if JE's response was inappropriate
to your needs, explained that there.

Otherwise you threads and may well cause respondents to waste time
duplicating replies.

---
Regards,
Norman



"uno@korsmaa" wrote in message
...
Dear professionals

Does the For ...To .. Next loop have a syntax where I could run 2
different number ranges in the same loop (will illustrate my question by
a
fake "code").

For n = 1 To 10 And For n = 21 To 30
... do something
Next n

I guess I could inside the loop, use an IF condition at the beginning and
let the loop ignore part of the numbers, but maybe there is a direct way
also.

-----------------------------------
All the best, and thanks in advance.
Uno Kõrsmaa







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default For To Next loop

Hi Norman

I am sorry but the link you sent me does not open any page, and I can still
not find the answer you were talking about in my Outlook Express threads.

I was not trying to cause any trouble I just didn't see anyone answering my
question , so I posted it again in hope that maybe this time someone would
notice and respond to it. Now I can not find it any more. What should I do
now?

rgs
Uno

PS
Why don't I see all the threads from Outlook Express and have to go to a
webpage?





"Norman Jones" wrote in message
...
Otherwise you threads ...


Otherwise you risk fragmenting threads ...

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Uno,

You asked this two days ago and received a detailed response from JE
McGimpsey:

http://tinyurl.com/3lran

You should stay in the same thread and. if JE's response was

inappropriate
to your needs, explained that there.

Otherwise you threads and may well cause respondents to waste time
duplicating replies.

---
Regards,
Norman



"uno@korsmaa" wrote in message
...
Dear professionals

Does the For ...To .. Next loop have a syntax where I could run 2
different number ranges in the same loop (will illustrate my question

by
a
fake "code").

For n = 1 To 10 And For n = 21 To 30
... do something
Next n

I guess I could inside the loop, use an IF condition at the beginning

and
let the loop ignore part of the numbers, but maybe there is a direct

way
also.

-----------------------------------
All the best, and thanks in advance.
Uno Kõrsmaa









  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default For To Next loop

Hi Uno,

This was J.E's reply:
=============== START
From: JE McGimpsey )
Subject: 2 questions

Newsgroups: microsoft.public.excel.programming
Date: 2004-09-13 10:09:48 PST


1) See the answer to Sheldon's "Worksheet Protection" thread.

2) One way:

For n = 1 To 30
If n <= 10 Or n=21
'... do this
End If
Next n

an alternate is to adjust n within the loop, but I don't recommend it on
general good programming principles:

For n = 1 To 30
'...do this
If n = 10 Then n = 20
Next n

Doing a null loop as in the first example won't take more than a few
microseconds.
=============== END

---
Regards,
Norman



"uno@korsmaa" wrote in message
...
Hi Norman

I am sorry but the link you sent me does not open any page, and I can
still
not find the answer you were talking about in my Outlook Express threads.

I was not trying to cause any trouble I just didn't see anyone answering
my
question , so I posted it again in hope that maybe this time someone would
notice and respond to it. Now I can not find it any more. What should I do
now?

rgs
Uno

PS
Why don't I see all the threads from Outlook Express and have to go to a
webpage?





"Norman Jones" wrote in message
...
Otherwise you threads ...


Otherwise you risk fragmenting threads ...

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Uno,

You asked this two days ago and received a detailed response from JE
McGimpsey:

http://tinyurl.com/3lran

You should stay in the same thread and. if JE's response was

inappropriate
to your needs, explained that there.

Otherwise you threads and may well cause respondents to waste time
duplicating replies.

---
Regards,
Norman



"uno@korsmaa" wrote in message
...
Dear professionals

Does the For ...To .. Next loop have a syntax where I could run 2
different number ranges in the same loop (will illustrate my question

by
a
fake "code").

For n = 1 To 10 And For n = 21 To 30
... do something
Next n

I guess I could inside the loop, use an IF condition at the beginning

and
let the loop ignore part of the numbers, but maybe there is a direct

way
also.

-----------------------------------
All the best, and thanks in advance.
Uno Kõrsmaa













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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Loop ? again chrisnsmith Excel Discussion (Misc queries) 11 February 24th 09 04:45 AM
Loop ? chrisnsmith Excel Discussion (Misc queries) 6 February 21st 09 03:54 PM
Worksheet_Change - loop within a loop bgm Excel Programming 1 January 19th 04 01:27 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


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