Trouble with Excel union

Discussion in 'Mac Programming' started by Vreditel, Sep 9, 2011.

  1. Vreditel macrumors newbie

    Jul 28, 2011
    Hello all!!!
    I have a trouble. I have Excel document, which contains some shapes and i needed to get Excel union in next format: "Address of the top left cell of the range which includes the shapes: Address of the right bottom cell of the range which includes the shapes". I have next code for this:
    on GET_FULL_USED_RANGE(wbId, wsId)
    	tell app "Microsoft Excel"
    		set ws to sheet wsId of workbook wbId
    		set ur to used range of ws
    		repeat with i from 1 to (count shapes of ws)
    			set so to shape i of ws
    			set tlc to get address of top left cell of so
    			set brc to get address of bottom right cell of so
    			set shpRng to range (tlc & ":" & brc) of ws
    			set ur to union range1 ur range2 shpRng
    		end repeat
    		return get address (range (get address ur) of ws)
    	end tell
    but it's return a string, which contains list of ranges- for example : "$A$1:$C$7,$C$8:$E$12,$F$4:$G$9,$J$11:$K$15".
  2. Vreditel thread starter macrumors newbie

    Jul 28, 2011
    Ok, thanks all, but now i changed my Java code for this problem and all is ok. My problem is resolved, but I still do not understand how to get range in standart format("A1:E15" for example) for returns union.

Share This Page