Script Only Activated in a Column of a Microsoft Excel Worksheet?


Trying to make a script that is only is triggered in a certain column of Excel documents. Is this possible?

Trying to make a script that will multiply my current cell and paste it to the same cell (overwriting), and one that divides that cell and pastes it into another.

The effected cells need to be blank or number values only

Not really. You cannot trigger a macro based on entering or leaving a cell, and you cannot have a macro that is active only when you are in a certain cell.

You can have a macro that is triggered by whatever means (and active only in the specific application/window), and that macro could possibly determine what cell you are in by AppleScript, and if so then apply different behaviours depending on the cell. But it would require that there is some way to identify the cell by AppleScript, or perhaps by some other means. I don't know Excel, so I don't know what means might be possible.

Hey Tanner,

Many things are possible with AppleScript, but you can't trigger a macro from an Excel worksheet.

Here's a trivial example:

tell application "Microsoft Excel"
   tell active sheet
      set theCell to a reference to cell "A1"
      set cellValue to value of theCell as integer
      set newValue to (cellValue * 10) as integer
      set theCell's value to newValue
   end tell
end tell

For help AppleScripting Excel please explore the following forums: