如果您知道这个范围如(A2:B4)那么您可以:
开始纵坐标:2
开始横坐标:利用Col2Num(A)来获取(1)
结尾纵坐标:4
结尾横坐标:利用Col2Num(B)来获取(2)
function Col2Num(ColName:string):integer;
var
Len,i:Integer;
BaseData:integer;
begin
Result:=0;
BaseData:=Ord('A')-1;
ColName:=UpperCase(ColName);
Len:=Length(ColName);
for i:=1 to Lendo
begin
Result:=Result+(Ord(ColName)-BaseData)*Trunc(Power(26,(Len-i)));
end;
end;