If I want to insert blank columns in Excel some like
tell application "Microsoft Excel"
activate
set StockCol to count columns of used range of active sheet
insert into range range "B:K" shift shift to right
end tell
I could use the union command but has that has a limit of I think 30 , besides being cumbersome I could run out of room. Or I could use a loop but far easier if I could use column 2 to column x.
I actual want to insert columns starting at column 2 the last insertion the count of the columns of the used range .
tell application "Microsoft Excel"
activate
tell active sheet
tell used range
--how many columns are there in the used range?
set colCount to count of columns
--set up a range from column 2 through the last column
--we do this by starting with column 2 and then expanding it
--out to column colCount-1
--we subtract 1 from colCount because we started at
--column 2
set rng to (get resize column 2 column size (colCount - 1))
--now insert into the used range a number of columns
--equal to the number of columns in rng
insert into range rng shift shift to right
end tell
end tell
end tell