I have an NX program which deals with csv files. All the files created during the process are merged into 1 excel file.
I‘d like to check how may column of data are in the csv file being processed (to create the correct offset when merging the data)
What is the correct syntax to figure out the last column being used start in cell A1? I had the info somewhere but cannot find it. Gettign old I guess !
If the file has 3 columns of data then I need to return column 3!
Solved! Go to Solution.
Something like this?
Const xlDown As Long = -4121 Const xlUp As Long = -4162 Const xlToRight As Long = -4161 Const xlMultiply As Long = 4 Const xlPasteAll As Long = -4104 objExcel.visible = True Dim LastRow As Integer Dim LastColumn As Integer LastRow = objWorksheet.Range("A65000").End(xlUp).Row LastColumn = objWorksheet.Range("A1").End(xlToRight).Column
I can post the full code if necessary, this bit just sets up the Excel constants (if you do not have an author license and cannot reference the Excel library directly) and shows the calls to get the last column and row.