Click here to Skip to main content
16,018,818 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello all,

Can anyone help me on this??
I have an excel workbook...now when i run my program, a new column is to be added at the end of used columns in a certain sheet and values are to be filled in it....i cant make it out how everytime the program can detect which is the last used non empty column??? as template won't be updated.....any hint on this??should i do something in the template or in the code???

help will be heartily appreciated.....:-)
Posted
Comments
Maciej Los 7-Jun-13 9:44am    
There are set of columns. What do you want to add and where?
Please, be more specific and provide more details.

hi
you can use this

with ******

Dim lastcolumn As Integer = .UsedRange.Columns.Count + 1

end with

***** will be the sheet you are working on
and you can replace Columns with rows to get the last raw
 
Share this answer
 
hi
you can use this

with ******

Dim lastcolumn As Integer = .UsedRange.Columns.Count + 1

end with

***** will be the sheet you are working on
and you can replace Columns with rows to get the last raw
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900