C
conio96
Hi, I have a program that will loop a folder, look for excel file and
process it. The following is part of the code I'm using.
Set xlBook = Workbooks.Open(filename)
For k = 1 To xlBook.Worksheets.Count Step 1
maxRow = xlBook.Sheets(k).UsedRange.Rows.Count
Debug.Print "maxrow is ", maxRow
For i = maxRow To 2 Step -1
'process the data
Next i
The problem I'm facing currently, when I run the macro, I received a
overflow runtime error on the maxRow =
xlBook.Sheets(k).UsedRange.Rows.Count. The strange thing is I only
receive this error when I run the program with certain files.
Can you tell me how to overcome this problem?
Thanks a lot..
process it. The following is part of the code I'm using.
Set xlBook = Workbooks.Open(filename)
For k = 1 To xlBook.Worksheets.Count Step 1
maxRow = xlBook.Sheets(k).UsedRange.Rows.Count
Debug.Print "maxrow is ", maxRow
For i = maxRow To 2 Step -1
'process the data
Next i
The problem I'm facing currently, when I run the macro, I received a
overflow runtime error on the maxRow =
xlBook.Sheets(k).UsedRange.Rows.Count. The strange thing is I only
receive this error when I run the program with certain files.
Can you tell me how to overcome this problem?
Thanks a lot..