![]() |
Macro Run-time Error 1004 Application Defined or Object Defined Error
I have Added 3 Sheets to Excel sheets that I use and disable macr
because it wouldnt work with my new sheet. The purpose of this excel spreed sheet is to count of page in th boxes. I added 3 sheets and tried adding in the new code I am no expert so am looking for some help with the code that I have added on. When debug, I get Run-time Error 1004 Application Defined or Object Define Error and stop here. Example of where the code stops continuation: counter = counter + 2 *Stops* --- ActiveCell.Offset(1, -counter).Select.Text While (ActiveCell.Value < "") GoTo continuehere If someone could please guide me in the right direction I would reall appreciate it. Thanks More Code Sub Record_Page_Count() Dim Box_number As String Dim strDocbaseName As String Dim strUser As String Dim strPassword As String Dim strDomain As String Dim intCount As Integer Dim pgCounttotal As Integer Dim pgCount As Integer 'Declare DFC variables Dim e As IDfException 'Exception object Dim clientx As IDfClientX 'DFC COM interface object Dim client As IDfClient 'DFC local client object Dim loginInfo As IDfLoginInfo Dim session As IDfSession Dim q As IDfQuery Dim col As IDfCollection Dim strDQL As String Dim obj As IDfTypedObject Dim Batch_no As String Sheets("Boxes").Select Range("A2").Select Sheets("ReproMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("DailyMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("FOMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("COMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("WCDMetrics").Select Rows("3:1000").Select Selection.ClearContents If (ActiveCell.Value = "REPRO") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("ReproMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("ReproMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count Result_RecordsCount: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount4 Result_PageCount4: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "DAILY") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("DailyMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("DailyMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count1 Result_RecordsCount1: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount5 Result_PageCount5: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "CO") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("COMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("COMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count8 Result_RecordsCount8: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount12 Result_PageCount12: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "FO") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("FOMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("FOMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count9 Result_RecordsCount9: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount13 Result_PageCount13: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "WCD") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("WCDMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("WCDMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count16 Result_RecordsCount16: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount20 Result_PageCount20: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend End If GoTo continuation continuation: counter = counter + 2 ActiveCell.Offset(1, -counter).Select.Text While (ActiveCell.Value < "") GoTo continuehere More code if you need to reply and all post it all --- Message posted from http://www.ExcelForum.com/ |
Macro Run-time Error 1004 Application Defined or Object Defined Error
Try it without the Select
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Anddmx " wrote in message ... I have Added 3 Sheets to Excel sheets that I use and disable macro because it wouldnt work with my new sheet. The purpose of this excel spreed sheet is to count of page in the boxes. I added 3 sheets and tried adding in the new code I am no expert so I am looking for some help with the code that I have added on. When I debug, I get Run-time Error 1004 Application Defined or Object Defined Error and stop here. Example of where the code stops continuation: counter = counter + 2 *Stops* --- ActiveCell.Offset(1, -counter).Select.Text While (ActiveCell.Value < "") GoTo continuehere If someone could please guide me in the right direction I would really appreciate it. Thanks More Code Sub Record_Page_Count() Dim Box_number As String Dim strDocbaseName As String Dim strUser As String Dim strPassword As String Dim strDomain As String Dim intCount As Integer Dim pgCounttotal As Integer Dim pgCount As Integer 'Declare DFC variables Dim e As IDfException 'Exception object Dim clientx As IDfClientX 'DFC COM interface object Dim client As IDfClient 'DFC local client object Dim loginInfo As IDfLoginInfo Dim session As IDfSession Dim q As IDfQuery Dim col As IDfCollection Dim strDQL As String Dim obj As IDfTypedObject Dim Batch_no As String Sheets("Boxes").Select Range("A2").Select Sheets("ReproMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("DailyMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("FOMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("COMetrics").Select Rows("3:1000").Select Selection.ClearContents Sheets("WCDMetrics").Select Rows("3:1000").Select Selection.ClearContents If (ActiveCell.Value = "REPRO") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("ReproMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("ReproMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count Result_RecordsCount: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount4 Result_PageCount4: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "DAILY") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("DailyMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("DailyMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count1 Result_RecordsCount1: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount5 Result_PageCount5: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "CO") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("COMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("COMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count8 Result_RecordsCount8: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount12 Result_PageCount12: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "FO") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("FOMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("FOMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count9 Result_RecordsCount9: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount13 Result_PageCount13: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend ElseIf (ActiveCell.Value = "WCD") Then ActiveCell.Offset(0, 1).Select Box_number = ActiveCell.Value Sheets("WCDMetrics").Select Range("A3").Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select While (ActiveCell.Value < "") counter = counter + 1 Selection.Copy Sheets("WCDMetrics").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Batch_no = ActiveCell.Value ActiveCell.Offset(0, 1).Select GoTo Record_Page_Count16 Result_RecordsCount16: ActiveCell.Value = intCount ActiveCell.Offset(0, 1).Select GoTo PageCount20 Result_PageCount20: ActiveCell.Value = pgCounttotal ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Wend End If GoTo continuation continuation: counter = counter + 2 ActiveCell.Offset(1, -counter).Select.Text While (ActiveCell.Value < "") GoTo continuehere More code if you need to reply and all post it all --- Message posted from http://www.ExcelForum.com/ |
Macro Run-time Error 1004 Application Defined or Object Defined Error
Just comes up in red.
I dunno what to do, I know it has to do with selection of the size. 'ActiveCell.Offset(1, -counter).select is pass this point and now have many errors. Result_PageCount4: ActiveCell.Value = pgCounttot *Error* ---- ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Thanks for helping me -- Message posted from http://www.ExcelForum.com |
Macro Run-time Error 1004 Application Defined or Object Defined Error
*Just comes up in red.
I dunno what to do, I know it has to do with selection of the size. 'ActiveCell.Offset(1, -counter).select is pass this point and now I have many errors. Result_PageCount4: ActiveCell.Value = pgCounttot [b]Error* ---- ActiveCell.Offset(1, -3).Select ActiveCell.Value = Box_number Sheets("Boxes").Select ActiveCell.Offset(0, 1).Select Thanks for helping me. I still has same error now I replaced ActiveCell.Offset(1, -3).Select with ActiveCell.Offset(0, 1).Select. Now I get the same error I post the first time. I am sure this has to do with the placements in sheets but I am lost on how to correct this problem. This is a macro button, do I have to edit anything else on this marco to make this work? --- Message posted from http://www.ExcelForum.com/ |
Macro Run-time Error 1004 Application Defined or Object Defined Error
Please someone I need some help :)
Sinking here, I ve tried everything I know -- Message posted from http://www.ExcelForum.com |
Macro Run-time Error 1004 Application Defined or Object Defined Error
What is the value of counter when it fails, and the address of activecell?
Is it trying to access off-sheet? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Anddmx " wrote in message ... Please someone I need some help :) Sinking here, I ve tried everything I know! --- Message posted from http://www.ExcelForum.com/ |
Macro Run-time Error 1004 Application Defined or Object Defined Error
When I try to compile the code all it does is stops at the same spot. S
I dunno if that mean there is something else wrong in the upper part o the code. All I need it to do is to look for Key words on the firs sheet "boxes" the take the count and put them on to there own sheets there are 6 sheets and there are COMetrics FOMetrics WCDMetrics. GoTo continuation continuation: counter = counter + 2 Stops---- ActiveCell.Offset(1, -counter).Select While (ActiveCell.Value < "") GoTo continuehere Wend GoTo jumpout Would there be a better way of doing this -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 06:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com