A
Anddmx
I am trying to get data from cells on sheets "boxes" and have date pu
on its own sheets "Reprometrics"ect and then add up the pages an
boxes. The code has no compile errors but when it comes to the end of
row it just stops and wont continue.I need it to go to the next row an
select the boxes and add up the page count but it wont LOL.
Need some help on figuring out how to pick the right formula.
Thanks
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("ReproMetrics").Select
Rows("3:1000").Select
Selection.ClearContents
Sheets("DailyMetrics").Select
Rows("3:1000").Select
Selection.ClearContents
Sheets("COMetrics").Select
Rows("3:1000").Select
Selection.ClearContents
Sheets("Boxes").Select
Range("A2").Select
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
If (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 PageCount10
Result_PageCount10:
ActiveCell.Value = pgCounttotal
ActiveCell.Offset(1, -3).Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(1, 1).Select
Wend
End If
GoTo continuation
continuation:
counter = counter + 2
ActiveCell.Offset(1, -counter).Select
While (ActiveCell.Value <> "")
GoTo continuehere
Wend
GoTo jumpout
continuehere:
If (ActiveCell.Value = "REPRO") Then
ActiveCell.Offset(0, 1).Select
Box_number = ActiveCell.Value
Sheets("ReproMetrics").Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
counter = 0
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_Count2
Result_RecordsCount2:
ActiveCell.Value = intCount
ActiveCell.Offset(0, 1).Select
GoTo PageCount6
Result_PageCount6:
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
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
counter = 0
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_Count3
Result_RecordsCount3:
ActiveCell.Value = intCount
ActiveCell.Offset(0, 1).Select
GoTo PageCount7
Result_PageCount7:
ActiveCell.Value = pgCounttotal
ActiveCell.Offset(1, -3).Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
Wend
If (ActiveCell.Value = "CO") Then
ActiveCell.Offset(0, 1).Select
Box_number = ActiveCell.Value
Sheets("COMetrics").Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
counter = 0
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_Count9
Result_RecordsCount9:
ActiveCell.Value = intCount
ActiveCell.Offset(0, 1).Select
GoTo PageCount11
Result_PageCount11:
ActiveCell.Value = pgCounttotal
ActiveCell.Offset(1, -3).Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ÿ¾¼,
on its own sheets "Reprometrics"ect and then add up the pages an
boxes. The code has no compile errors but when it comes to the end of
row it just stops and wont continue.I need it to go to the next row an
select the boxes and add up the page count but it wont LOL.
Need some help on figuring out how to pick the right formula.
Thanks
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("ReproMetrics").Select
Rows("3:1000").Select
Selection.ClearContents
Sheets("DailyMetrics").Select
Rows("3:1000").Select
Selection.ClearContents
Sheets("COMetrics").Select
Rows("3:1000").Select
Selection.ClearContents
Sheets("Boxes").Select
Range("A2").Select
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
If (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 PageCount10
Result_PageCount10:
ActiveCell.Value = pgCounttotal
ActiveCell.Offset(1, -3).Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(1, 1).Select
Wend
End If
GoTo continuation
continuation:
counter = counter + 2
ActiveCell.Offset(1, -counter).Select
While (ActiveCell.Value <> "")
GoTo continuehere
Wend
GoTo jumpout
continuehere:
If (ActiveCell.Value = "REPRO") Then
ActiveCell.Offset(0, 1).Select
Box_number = ActiveCell.Value
Sheets("ReproMetrics").Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
counter = 0
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_Count2
Result_RecordsCount2:
ActiveCell.Value = intCount
ActiveCell.Offset(0, 1).Select
GoTo PageCount6
Result_PageCount6:
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
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
counter = 0
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_Count3
Result_RecordsCount3:
ActiveCell.Value = intCount
ActiveCell.Offset(0, 1).Select
GoTo PageCount7
Result_PageCount7:
ActiveCell.Value = pgCounttotal
ActiveCell.Offset(1, -3).Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
Wend
If (ActiveCell.Value = "CO") Then
ActiveCell.Offset(0, 1).Select
Box_number = ActiveCell.Value
Sheets("COMetrics").Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ActiveCell.Offset(0, 1).Select
counter = 0
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_Count9
Result_RecordsCount9:
ActiveCell.Value = intCount
ActiveCell.Offset(0, 1).Select
GoTo PageCount11
Result_PageCount11:
ActiveCell.Value = pgCounttotal
ActiveCell.Offset(1, -3).Select
ActiveCell.Value = Box_number
Sheets("Boxes").Select
ÿ¾¼,