Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"subscript out of range" for the sub headline

Status
Not open for further replies.

Ranf

Technical User
May 1, 2003
6
IL
Hi everyone!
I get a "Subscript out of range - Runtime error 9" marked on the "headline" of the sub ("Sub Sortand...").
It happens only when I change the file names inside the function. For some it works and for other doesn't. I've verified that the files exist.
I've never incountered a runtime error 9 on the "title" of a sub.
I would appreciate if someone could help me on this one...
Thanks,
- Ran :)

Here is the sub:


Sub SortandCopyLoop()
Dim j, k, IL As Integer
IL = 2

For k = 1 To 3
For j = 1 To 2
CopyEveryParticleMass "DDP-LD-221.xls", "isaOP1-" & k * 100 & "-" & j * 100 & "-500-10-1-LD-1E-5-221", k, j + (14 * (IL - 1))
CopyLSP "DDP-LD-221.xls", "isaOP1-" & k * 100 & "-" & j * 100 & "-500-10-1-LD-1E-5-221", k, j + (14 * (IL - 1))
Windows("isaOP1-" & k * 100 & "-" & j * 100 & "-500-10-1-LD-1E-5-221").Close (False) 'Closes the source file
Next j
Next k
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top