Hi Kazkek;
Please try the following solution:
1) Get the data of column A by using GetDataObject method.
2) Compare each data with zero to decide which one will be put into column B, and which one will stay in column A.
3) Set new data to column A and column B by using DataRange.
See the code below:
void split_column()
{
Worksheet wks = Project.ActiveLayer();
if(!wks)
return;
Column colA = wks.Columns(0); // column A
Column colB = wks.Columns(1); // column B
if(!colA || !colB)
return;
vector vA = colA.GetDataObject(); // get data in column A
vector vB; // hold data of column B
vector vANew; // hold new data of column A
for(int iEle=0; iEle<vA.GetSize(); iEle++) // loop all data in column A
{
if(vA[iEle]>0) // if >0, add to column B
vB.Add(vA[iEle]);
else
vANew.Add(vA[iEle]); // else, stay in column A
}
DataRange drA;
drA.Add("X", wks, 0, 0, -1, 0); // data range of column A
drA.SetData(vANew); // set new data to column A
DataRange drB;
drB.Add("X", wks, 0, 1, -1, 1); // data range of column B
drB.SetData(vB); // set data to column B
}
Penn