how to add a col in excel programmtically?

philky001

Board Regular
Joined
Jun 8, 2005
Messages
129
We get an excel worksheet from a customer and there is a data discrepance with one of the col.the item description they send. We want to programmatically open the document lookup the table using item column, and then write a new column with the item description from the table (on SQLSever) that part of getting the data is fine but how to create such a new column is where I am stumped. writing in asp.net but open to however it can be done I am getting this error when trying to insert a column:


To prevent possible loss of data, Excel cannot shift nonblank cells off of the worksheet. Select another location in which to insert new cells, or delete data from the end of your worksheet.

If you do not have data in cells that can be shifted off of the worksheet, you can reset which cells Excel considers nonblank. To do this, press CTRL+End to locate the last nonblank cell on the worksheet. Delete this cell and all cells between it and the last row and column of your data then save.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Never used asp.net. Not knowing where your source data is and how you intend to automate the process, I cannot comment on the best way....

But looking at the error message, I am tempted to ask if all the 256 available columns in the spreadsheet have been used in at least one of the rows of the spreadsheet.

Did you try hitting "Ctrl+End" while on the spreadsheet to see what is the last non-blank cell?

Did you manually try to insert a column in the spreadsheet? Were you successful?

If you reply back with your code, others on the forum with asp.net experience might be able to look at the code and fix it if there are any errors.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top