Run-time error 1004

D

dthmtlgod

I keep on getting the error above at the end of my routine. I use the same
routine on many other types of reports, however, I don't get the error on
those reports. I can't figure it out. Any ideas?

x = 2
i = 5

Sheets("L001.TXT").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A1:AA65536").Select
Selection.ClearContents
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

y = Range("L001.TXT!G" & Rows.Count).End(xlUp).Row + 1 'Assumes nothing
beneath the
Range("L001.TXT!G" & y).Value = "X"

Sheets("MAIN").Select
Range("A1").Select

Application.StatusBar = "Loading data ...."

Do While Range("L001.TXT!G" & X) <> "X"
If Range("L001.TXT!B" & X) = "OFF" Then
Do While Len(Range("L001.TXT!G" & X + 1)) > 0
Range("IRES!J" & i).Value = "023"
Range("IRES!D" & i).Value = Format(Range("L001.TXT!B" & X + 1),
"000") & Format(Range("L001.TXT!D" & X + 1), "000") & "C"
Range("IRES!A" & i).Value = Date
Range("IRES!B" & i).Value = "IRES"
Range("IRES!H" & i).Value = "OPEN"
Range("IRES!I" & i).Value = "1ST"
Range("IRES!E" & i).Value = "N/A"
Range("IRES!F" & i).Value = "POLICY: " & Range("L001.TXT!G" & X
+ 1).Value
i = i + 1
X = X + 1
Loop
End If
X = X + 1
Loop
 
D

dthmtlgod

I figured it out. It was jumping over my "X" check and going to the button
of the spreadsheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Conflict 8
For Eachcell in Range tranpose comma seperated values to a list in D 4
Error '1004' 4
Loop to End 0
Search 14
Loop Without Do 4
Loop Repeats - PLS HELP 2
Excel VBA help: Text file formatting 19

Top