I have a VBA macro that worked correctly in Excel 2007, but after updating to 2010, it causes errors. A macro basically copies raw data from one sheet to several sheets. Error 6 due to overflow. The line that throws the error is Dim
y As Integer y = Worksheets("Raw Data").Range("A2").End(xlDown).Row
I initially thought it was okay to redo it to the end, and it would kill the overflow error. Well, I think he killed the error, but also returned very incorrect results, and then added that the overflow error didn’t even make sense ... just 973 lines.
Then I thought it might be better to try this instead
Cells(Rows.Count,"A").End(xlUp).Offset(1,0).Select
Now it throws a "Runtime Error" 1004 "method" object range "_global" failed "on the line after.
below is part of the complete code. I suppose this could be an overflow error? Any help is appreciated.
Dim y As Integer 'y = Worksheets("Raw Data").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Select y = Worksheets("Raw Data").Range("A2").End(xlDown).Row Range("B1:U" & y).Select Selection.Copy Sheets("Yellow Suppliers").Select Range("B2").Select ActiveSheet.Paste Columns("C:E").Select Selection.Delete Shift:=xlToLeft Columns("P:Q").Select Selection.Delete Shift:=xlToLeft Columns("A").ColumnWidth = 2.14 Columns("B").ColumnWidth = 43.43 Columns("C").ColumnWidth = 12.14 Columns("D:O").ColumnWidth = 8 Columns("P").ColumnWidth = 10.14 Rows("1").RowHeight = 15 Rows("2:" & y).RowHeight = 30 Range("B3:B22").Select Selection.Font.Bold = True
woody source share