• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

runtime error 92

RAM72

Member
Hi All

Copying from report sheet to a csv sheet format.

Got message run time error 92
For loop not initiliazed .

Can anyone help please:confused::confused:

Next n
Code:
Sub copy_specific_CSV()

For n = 2 To Sheets("Summary Report ").Range("A" & Rows.Count).End(xlUp).Row

l = Sheets("CSV ").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("CSV ").Range("B" & l).Value = Sheets("Summary Report ").Range("A" & n).Value 'copy column A (Sheet1) to Column A (Sheet2)
Sheets("CSV ").Range("C" & l).Value = Sheets("Summary Report ").Range("B" & n).Value 'copy column B (Sheet1) to Column B (Sheet2)
Sheets("CSV ").Range("E" & l).NumberFormat = "@"
Sheets("CSV ").Range("E" & l).Value = Sheets("Summary Report ").Range("C" & n).Value 'copy column C (Sheet1) to Column C (Sheet2)
Sheets("CSV ").Range("I" & l).Value = Sheets("Summary Report ").Range("D" & n).Value 'copy column F (Sheet1) to Column D (Sheet2)
Sheets("CSV ").Range("L" & l).Value = Sheets("Summary Report ").Range("E" & n).Value 'copy column F (Sheet1) to Column D (Sheet2)
Sheets("CSV ").Range("M" & l).NumberFormat = "@"
Sheets("CSV ").Range("M" & l).Value = Sheets("Summary Report ").Range("H" & n).Value 'copy column F (Sheet1) to Column D (Sheet2)

Next n

End Sub
'Summary Report
 
Nothing suspicious in your code. Maybe it is tripping with your data. If you could step through code using F8 and see when the error is getting raised.
 
Back
Top