Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
2 questions
Hello gurus
1) How to programmatically check if a workbook is protected or not? 2) Does the For ...To .. Next loop have a syntax where I could run 2 different number ranges in the same loop. I will illustrate my question by a fake "code". For n = 1 To 10 And For n = 21 To 30 ... do this Next n I came up with an idea where I would 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
2 questions
Hi Uno,
Question 2 Not AFAIK however, you could try For N = 1 to 30 'do some thing If N =10 then N = 20 Next regards, Don "uno@korsmaa" wrote in message ... Hello gurus 1) How to programmatically check if a workbook is protected or not? 2) Does the For ...To .. Next loop have a syntax where I could run 2 different number ranges in the same loop. I will illustrate my question by a fake "code". For n = 1 To 10 And For n = 21 To 30 ... do this Next n I came up with an idea where I would 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
2 questions
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. In article , "uno@korsmaa" wrote: Hello gurus 1) How to programmatically check if a workbook is protected or not? 2) Does the For ...To .. Next loop have a syntax where I could run 2 different number ranges in the same loop. I will illustrate my question by a fake "code". For n = 1 To 10 And For n = 21 To 30 ... do this Next n I came up with an idea where I would 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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Answers to questions posing more questions in a workbook | Excel Worksheet Functions | |||
View Questions and Answer to questions I created | Excel Discussion (Misc queries) | |||
2 questions again | Excel Programming | |||
2 questions | Excel Programming | |||
VB questions | Excel Programming |