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
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