ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run time error 13 with new Collection (https://www.excelbanter.com/excel-programming/359212-run-time-error-13-new-collection.html)

Tomkat743

Run time error 13 with new Collection
 
Type Mismatch

Stops on Line: "For Each itm In Collection" (says no itm no Collection.)

Any thoughts? Please help
Also why does VB put a space between row and column

Dim bkList As New Collection
With Workbooks("1DLSUNDAY.XLS").Worksheets("Master")
Set rng = .Range(.Cells(2, 3), .Cells(2, 3).End(xlDown))
End With

On Error Resume Next
For Each cell In rng
bkList.Add Trim(cell.Text), Trim(cell.Text)
Next
On Error GoTo 0

For Each itm In Collection
Workbooks.Open "C:\Documents and Settings\Tom\Desktop\CHARTER BLANK\NEW
BLANK\" & _
itm & ".xls"
Next

JMB

Run time error 13 with new Collection
 
Maybe

For Each itm In bkList

"Tomkat743" wrote:

Type Mismatch

Stops on Line: "For Each itm In Collection" (says no itm no Collection.)

Any thoughts? Please help
Also why does VB put a space between row and column

Dim bkList As New Collection
With Workbooks("1DLSUNDAY.XLS").Worksheets("Master")
Set rng = .Range(.Cells(2, 3), .Cells(2, 3).End(xlDown))
End With

On Error Resume Next
For Each cell In rng
bkList.Add Trim(cell.Text), Trim(cell.Text)
Next
On Error GoTo 0

For Each itm In Collection
Workbooks.Open "C:\Documents and Settings\Tom\Desktop\CHARTER BLANK\NEW
BLANK\" & _
itm & ".xls"
Next


Tomkat743

Run time error 13 with new Collection
 
Thanks alot I just couldn't see it.

"JMB" wrote:

Maybe

For Each itm In bkList

"Tomkat743" wrote:

Type Mismatch

Stops on Line: "For Each itm In Collection" (says no itm no Collection.)

Any thoughts? Please help
Also why does VB put a space between row and column

Dim bkList As New Collection
With Workbooks("1DLSUNDAY.XLS").Worksheets("Master")
Set rng = .Range(.Cells(2, 3), .Cells(2, 3).End(xlDown))
End With

On Error Resume Next
For Each cell In rng
bkList.Add Trim(cell.Text), Trim(cell.Text)
Next
On Error GoTo 0

For Each itm In Collection
Workbooks.Open "C:\Documents and Settings\Tom\Desktop\CHARTER BLANK\NEW
BLANK\" & _
itm & ".xls"
Next



All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com