0

I want to use AppleScript to find a TAG cell I put next to sets of data, so that I can then link to those values on a separate results sheet.

At the moment all I get is errors telling me that this, that and the other doesn't understand find. Here's the script:

tell application "Microsoft Excel"
    tell active workbook
        activate object worksheet "1001"
        tell sheet "1001"
            set searchRange to used range
            tell searchRange
                (find searchRange what "TAG")
            end tell
        end tell
    end tell
end tell

I'm a complete beginner with this so completely stumped

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Priesto
  • 61
  • 7

1 Answers1

0

The following works very well for me: (this code goes between tell sheet "1001" and end tell):

set searchRange to used range
try
    set foundRange to find searchRange what "blurp" with match case
    (* do something with the foundRange *)
on error -- not found
    (* do error handling *)
end try

If it finds "blurp", a range is returned (something like range "'[Workbook1]1001'!$D$4" of application "Microsoft Excel"), otherwise an error is thrown (which simply means that what you searched for was not found).

fanaugen
  • 1,107
  • 2
  • 10
  • 22