Hi Matt,
Please try the following function:////////////////////////////////////////////////////////////////
function double moverows(double rFrom, double rTo, double Dest) {
nr=wks.maxRows;
if((rFrom<=Dest && Dest<=rTo) || nr<Dest-1 || Dest<=0) {
type -b Invalid range;
Return -1;
}
worksheet -a 1; //add the key column
nc=wks.nCols;
if(Dest>rTo) {
for(ii=1;ii<=nr;ii++) {
if(ii<rFrom || ii>=Dest) wcol(nc)[ii]=ii;
else if(rFrom<=ii && ii<=rTo) wcol(nc)[ii]=ii+Dest-rTo-1; //when from<=ii<=To
else wcol(nc)[ii]=ii-rFrom; //when To<ii<=Dest
}
}
if(Dest<rFrom) {
for(ii=1;ii<=nr;ii++) {
if(ii<Dest || ii>rTo) wcol(nc)[ii]=ii;
else if(rFrom<=ii && ii<=rTo) wcol(nc)[ii]=ii+Dest-rFrom; //when from<=ii<=To
else wcol(nc)[ii]=ii-rFrom+rTo+1; //when Dest<=ii<From
}
}
wsort bycol:=$(nc) descending:=0; //sort worksheet
delete wcol(nc); //delete the key column
Return 1;
}
////////////////////////////////////////////////////////////////
To execute this function, you can, for example, issue the following call with three argument - From, To, and Destination:moverows 667,1000,1;
Hope this works.
--Hideo Fujii
OriginLab