M
mastermind
I have written the code bellow, but for some reason the calculation at
the heart of the code keeps failing. Can anyone tell me why, or
better yet how to fix this problem. Thank you.
Sub Summary()
Set DescriptionTotals = Worksheets("Data
Sheet").Range("D11
50,J11:J50,D54
353")
Set QuantityTotals = Worksheets("Data
Sheet").Range("C11:C50,I11:I50,E54:E353")
QuantityTotals = 0
For Each ws In ActiveWorkbook.Sheets
If ws.Name Like "Report *" Then
Set WorksheetDescription =
ws.Range("B17:K31,AE17:AS31,B35:V54")
Set WorksheetQuantity =
ws.Range("BJ17:BJ31,AT17:AX31,W35:AB54")
ind1 = 0
For Each c1 In WorksheetDescription
ind1 = ind1 + 1
If c1.Value > "" Then
ind2 = 0
For Each c2 In DescriptionTotals
ind2 = ind2 + 1
If c2.Value <> "" Then
If c1.Value = c2.Value Then
QuantityTotals.Cells(ind2).Value = _
QuantityTotals.Cells(ind2).Value + _
WorksheetQuantity.Cells(ind1).Value
End If
End If
Next c2
End If
Next c1
End If
Next ws
End Sub
the heart of the code keeps failing. Can anyone tell me why, or
better yet how to fix this problem. Thank you.
Sub Summary()
Set DescriptionTotals = Worksheets("Data
Sheet").Range("D11


Set QuantityTotals = Worksheets("Data
Sheet").Range("C11:C50,I11:I50,E54:E353")
QuantityTotals = 0
For Each ws In ActiveWorkbook.Sheets
If ws.Name Like "Report *" Then
Set WorksheetDescription =
ws.Range("B17:K31,AE17:AS31,B35:V54")
Set WorksheetQuantity =
ws.Range("BJ17:BJ31,AT17:AX31,W35:AB54")
ind1 = 0
For Each c1 In WorksheetDescription
ind1 = ind1 + 1
If c1.Value > "" Then
ind2 = 0
For Each c2 In DescriptionTotals
ind2 = ind2 + 1
If c2.Value <> "" Then
If c1.Value = c2.Value Then
QuantityTotals.Cells(ind2).Value = _
QuantityTotals.Cells(ind2).Value + _
WorksheetQuantity.Cells(ind1).Value
End If
End If
Next c2
End If
Next c1
End If
Next ws
End Sub