Excel 2011 variable cell range

Hello,

Is there a way to create a cell range from a column that will always start at the same point, i.e. F6 but the end point will be determined by the last used row of the preceding column (as column F at this point will be empty).

I have managed to get a reference to the last used row using

set lastNum to (first row index of (get end (last cell of column 5) direction toward the top)) as integer

But I just can’t seem to use that when trying to define the cell range. I have tried attaching it to F and then passing that into a select cell range / set value of cell range command but nothing seems to work.

Each time the length of the spreadsheet will differ.

Any help would be greatly appreciated!
Thanks!

Hi,

do you mean this


tell application "Microsoft Excel"
	set lastNum to (first row index of (get end (last cell of column 5) direction toward the top)) as integer
	set fRange to range ("F6:F" & lastNum)
end tell

Thanks! Thats perfect. :smiley: