The debug stops in BC, Sec and DestArray(i). I have already defined them as integer.
I have a range named bgtgroupfiledest = C:\Documents and Settings\P1ng2\My Documents\TEST\
This code - I am trying to open a file from each name in the table. Then, copy and paste value into the open file.
Sub Target()
Dim i As Integer
Dim BC As Integer
Dim DestArray() As String
Dim Sec As Integer
BC = Worksheets("Target").Cells(i, 2).Value
Sec = Worksheets("Target").Cells(i, 1).Value
DestArray(i) = bgtgroupfiledest %26amp; BC %26amp; "\S" %26amp; Sec %26amp; ".xls"
For i = 6 To 7
Workbooks.Open (DestArray(i))
Sheets("SAL HEADS").Select
ActiveSheet.Unprotect "cool"
Application.Calculation = xlCalculationManual
Windows("TargetTables1.xls").Activate
Sheets("Target").Select
Cells(i, 2).Copy
Windows("S" %26amp; Sec %26amp; ".xls").Activate
Range("T122").PasteSpecial Paste:=xlValues
ActiveWorkbook.Close savechanges:=True
Next i
End Sub
Runtime Error 1004 - Application Defined Error?
Check this page out, if it does not help, just search for Runtime Error 1004 - Application Defined Error in their KDB.. Going to the source is sometimes the best answer.
gladiolus
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment