Sujeet Raman

Sujeet Raman

  • 863
  • 927
  • 352.6k

Column values Lost After Re-order columns in  c# excel interop

Aug 26 2021 7:55 AM

Hi,

Column values Lost After Re-order columns in  c# excel interop

how can i re order my columns following way.i used this syntax but i lost particular coloumn data'

Excel.Range copyRange = xlWorksheet.Range["A:A"];
Excel.Range insertRange = xlWorksheet.Range["P:P"];
insertRange.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, copyRange.Cut());

ORIGINAL

"Account_No";
"FIRST_NAME";
"MIDDLE_NAME";
"LAST_NAME";
"Effective_Date";
"Birth_Year";
"SSN";
"Gender";
"Tobacco";
"ADDR_LINE1";
"CITY_NAME";
"ZIP_CODE";
"PCP ID ";
"Policy No";/N
"Product Offering ";
"State";

How can i reorder below coloumns like first one with out lose data

POLICY_NO
ACCOUNT_NO|
FIRST_NAME|
MIDDLE_NAME|
LAST_NAME|
EFFECTIVE_DATE
|BIRTH_YEAR
|SSN|
GENDER|
ADDR_LINE1|
CITY_NAME|
ZIP_CODE|
STATE|
TOBACCO|
PCP ID|
PRODUCT OFFERING


Answers (3)