Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save metzenseifner/66f9ef2beb65ad3e44a5a7deea3d4aaf to your computer and use it in GitHub Desktop.
Save metzenseifner/66f9ef2beb65ad3e44a5a7deea3d4aaf to your computer and use it in GitHub Desktop.
Excel Row Sequence Column by Column
tell application "Microsoft Excel"
set screen updating to false -- optimize performance
set range_selected to selection
-- setup ref vars for selection
tell selection to set {range_selected_row_index, range_selected_column_index, range_selected_row_count, range_selected_column_count} to {get first row index of selection, get first column index of selection, get count rows of selection, get count columns of selection}
-- go row by row and iterate each column in each row
repeat with row_step from range_row_index to range_row_count -- row iteration
repeat with column_step from range_column_index to range_column_count -- column iteration
set range_this_cell to range (get address row row_step of column col_step of active sheet) of active sheet
log range_selected
end repeat
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment