Using if/then/else block to end repeat block
I've been grappling with AppleScript for 3 weeks now.
I've got a chunk of the following code to work but it just won't compile.
Working with Excel 2004 here.
What I'm trying to do is to use an if/then/else block to break out of a repeat block.
After the autofiltering, if visibleCount is 0, I want it to move on to the next item in PnList.
But if visibleCount is not 0, I want it to carry on with the code.
I'd appreciate any help I can get.
Cheers,
Wilfred
the code looks like this:
repeat with p from 1 to (count of items in PnList)
tell range "A2" of active sheet
autofilter range
autofilter range field 1 criteria1 ¬
(item p of PnList)
end tell
set visibleCount to "A1"
set value of visibleCount to "=SUBTOTAL(2,A:A)-2"
if visibleCount = 0
then end repeat
else
set myRange2 to (special cells (range ("3:" & (count rows in used range of active sheet) as string)) type cell type visible)
set RStart2 to first row index of myRange2
set REnd2 to count rows in myRange2
set REnd2 to RStart2 + REnd2 - 1
show all data of active sheet
copy range range (RStart2 & ":" & REnd2 as string)
--new sheet with only NPI data
set NewBk2 to make new workbook
set RRNPI to get name of active workbook
paste special range "A3" what values
end repeat
Message was edited by: wilfredph
MacBook Pro, Mac OS X (10.6.4)