Hello,
I have this script and the LastColumn and LastRow lines do not work. Any suggestions?
Thank you
I have this script and the LastColumn and LastRow lines do not work. Any suggestions?
Thank you
Code:
Set objExcel = CreateObject("Excel.Application")
strExcelPath="C:\TMP\TEST.XLSX"
objExcel.Workbooks.Open strExcelPath
objExcel.Visible = True
Set objSheet = objExcel.ActiveWorkbook.Worksheets(2)
With objExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(2)
LastColumn = objSheet.Cells(1, .Columns.Count).End(xlToRight).Column
LastRow = objSheet.Cells(.Rows.Count, 4).End(xlUp).Row
End With