2015-06-25 4 views
-1

Это то, что у меня есть. Я только начал использовать applescript, поэтому я действительно не знаю, что происходит. По сути, я хочу выбрать первые 50 строк, если в столбце J. нет значений inf. Если есть значения inf, то должно быть 50 + эта сумма.Как я могу зациклиться на столбце excel с applescript?

tell application "Microsoft Excel" 
    tell active workbook 
     select cell "J1" 
     set i to 1 
     if value of cell ("J" & i) is equal to "inf" then 
      repeat while value of cell ("J" & i) is equal to "inf" 
       set i to i + 1 
      end repeat 
      return i 
      set myRows to range "1:50+i" 
      select myRows 
     else 
      set myRows to range "1:50" 
      select myRows 
     end if 
    end tell 
end tell 

ответ

0

попробовать это

tell application "Microsoft Excel" 
    tell active sheet 
     set i to 0 
     if value of range ("J1") = "inf" then 
      set i to i + 1 
      repeat while value of range ("J" & i) = "inf" 
       set i to i + 1 
      end repeat 
     end if 
     set myRows to range ("1:" & 50 + i) 
     select myRows 
    end tell 
end tell