NateW
10-17-2007, 12:54 PM
Hi, Folks...
I'm trying to do what I thought would be a very simple macro - sort of the basis for something more complicated
I'm planning, but of course I'm getting hung up on the first step. The following code produces the following error:
Run-time error 1004: Application-defined or Object-defined error
Sub Calculate_KPI()
Dim DataRow, QueryRow As Integer
Application.ScreenUpdating = False
DataRow = 2
ScheduleRow = 2
Sheets("Query Results").Activate
Do Until Sheets("Data").Cells(DataRow, 1).Value = ""
' THIS IS IS THE LINE THE DEBUGGER POINTS TO AFTER ERROR:
Sheets("Query Results").Cells(QueryRow, 1).Value = Sheets("Data").Cells(DataRow, 7).Value
Sheets("Query Results").Cells(QueryRow, 2).Value = Sheets("Data").Cells(DataRow, 8).Value 'Order Number
Sheets("Query Results").Cells(QueryRow, 3).Value = Sheets("Data").Cells(DataRow, 9).Value 'Order details
QueryRow = QueryRow + 1
DataRow = DataRow + 1
Loop
Application.ScreenUpdating = True
End Sub
All sheets are within the same workbook, and I've checked to see if all names match up, which I'm *pretty*
sure they do - but you know how sometimes that can be missed... What am I missing?
Thanks for your help!!!
I'm trying to do what I thought would be a very simple macro - sort of the basis for something more complicated
I'm planning, but of course I'm getting hung up on the first step. The following code produces the following error:
Run-time error 1004: Application-defined or Object-defined error
Sub Calculate_KPI()
Dim DataRow, QueryRow As Integer
Application.ScreenUpdating = False
DataRow = 2
ScheduleRow = 2
Sheets("Query Results").Activate
Do Until Sheets("Data").Cells(DataRow, 1).Value = ""
' THIS IS IS THE LINE THE DEBUGGER POINTS TO AFTER ERROR:
Sheets("Query Results").Cells(QueryRow, 1).Value = Sheets("Data").Cells(DataRow, 7).Value
Sheets("Query Results").Cells(QueryRow, 2).Value = Sheets("Data").Cells(DataRow, 8).Value 'Order Number
Sheets("Query Results").Cells(QueryRow, 3).Value = Sheets("Data").Cells(DataRow, 9).Value 'Order details
QueryRow = QueryRow + 1
DataRow = DataRow + 1
Loop
Application.ScreenUpdating = True
End Sub
All sheets are within the same workbook, and I've checked to see if all names match up, which I'm *pretty*
sure they do - but you know how sometimes that can be missed... What am I missing?
Thanks for your help!!!