Copy & Paste from Excel Cells to Individual Clipboards

Hey Ashley,

Gabe spent a lot more time and effort on this than you might realize.

Kudos -- you did a better job defining your task than a lot of folks do.

The one major thing you could have done to move things along more efficiently is to provide an example Excel worksheet populated with at least a few lines of data for people to test with.

(Non-Keyboard-Maestro file-types other than images must be zipped to be uploaded to the forum.)

Macros are built by testing, not talking (or writing) – so anything you can do to facilitate that will make it more likely for someone to spend their valuable time and volunteer to help you.


If you haven't read either of these, they're worth a couple of minutes of your time:

Tip: How Do I Get The Best Answer in the Shortest Time?

How to Post Your Macro to the Forum


Gabe has chosen to drive the UI and use the Clipboard to set and get the desired data.

While this can be an effective method (and is sometimes the only means available), I don't like using it when there's an alternative. (Especially with Microsoft applications that tend to clutter the Clipboard with copious invisible data-types that can stall a macro under certain circumstances.)

The following AppleScript will place the date in the selected cell, and it will extract the data from the seven cells to its right without using the Clipboard or changing the selection.

All extracted data is placed in Keyboard Maestro variables.


Emplace Date in Active Cell and Extract Data from Cells to the Right of It v1.00.kmmacros (6.2 KB)


For this sort of job AppleScript is very effective and not especially complicated (for a change).

I don't use local variables when developing, because I want to be able to see variable names and values in the variable inspection panel in the Keyboard Maestro preferences. So there's a need for housekeeping after the macro is run.

This AppleScript action will import into the macro currently being edited and should be placed at the end of the macro; it will do the requisite housekeeping.

Execute an AppleScript.kmactions (2.1 KB)

-Chris

5 Likes