Excel data....Start in cell "B8" and move down column B

I need direction on how I could go about collecting each value from cell B8 down through column B until there is no data in the cell. Which is usually around cell “B80” or so. It does change occasionaly, so I want it to be dynamic to compensate for this.

I guess I want to repeat with i until a cell returns “missing value”. I’m just not sure how to approach it.

The final result will put each iteration, or cell into a script generated xml file.

FYI, I’m at work and I do not have access to the Terminal at all. :frowning:

I get the feeling that the following code is embarrasingly innacurate for what I want to do…

property theRow : 7

tell application "Microsoft Excel"
	set i to "Nothing"
	set theCol to "B"
	repeat until i is missing value
		set i to get value of cell (theCol & (theRow + 1))
	end repeat
end tell

Any help is much appreciated!
Cheers!

Here’s one way to do it…

-- Grab data from selected cell
set newcell to "1"
set mycells to {}
repeat until newcell = "" or "0"
	tell application "Microsoft Excel"
		activate
		set newcell to value of selection
		if newcell is not equal to "" and newcell is not equal to "0" then
			set mycells to mycells & newcell as list
			-- Move to next cell
			tell application "System Events" to keystroke (key code 125) -- keystoke down arrow
		end if
	end tell
	
	-- Quit script if Excel is no longer running
	tell application "System Events"
		if not (exists process "Microsoft Excel") then quit
	end tell
end repeat

return mycells

Thanks so much for the quick responses. Jacques, yours seems to be more robust. I already have so many more questions, but I’ll refrain until I have gone over every aspect 100%.

Thanks again,
Brad