Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run the macro until activeSheet.previous.Select = Sheet2
Hi,
I want a loop which will stop if the activesheet is "Sheet2" of the workbook. Regards Heera |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run the macro until activeSheet.previous.Select = Sheet2
Found = False
for sht in sheets if sht.name = "Sheet2" then Found = true exit for end if next sht if Found = true then 'enter your code here end if "Heera" wrote: Hi, I want a loop which will stop if the activesheet is "Sheet2" of the workbook. Regards Heera |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run the macro until activeSheet.previous.Select = Sheet2
Try a construction like this...
Dim WS As Worksheet ..... ..... For Each WS In Worksheets If WS.Name = "Sheet2" Then ' ' You found Sheet2, so execute your code here ' Exit For End If Next ...... ...... Note the Exit For statement after your Sheet2 code... that stops the loop from continuing on (you already found Sheet2, so there is no longer any need to keep looping looking for it). Rick "Heera" wrote in message ... Hi, I want a loop which will stop if the activesheet is "Sheet2" of the workbook. Regards Heera |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run the macro until activeSheet.previous.Select = Sheet2
Thank you but I used this code.
Do While ActiveSheet.Name < "Sheet2" My entire procedure Loop |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro to print sheet2 without open sheet2 | Excel Discussion (Misc queries) | |||
ActiveSheet.name not returning Sheet1, Sheet2 | Excel Programming | |||
Select the ActiveSheet & the sheet next to it | Excel Discussion (Misc queries) | |||
ActiveSheet.Next.Select not working! | Excel Programming | |||
activesheet - select rows | Excel Programming |