Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime 13 - type mismatch
hi,
i am trying to fix a marco that has suddenly broken and the person who created no longer works for us. i am getting the type mismatch error on the following line. - any assistance would be great. TotalBroke = TotalBroke + Cells(i, 4).Value the whole module is below Sub BrokeProductionCalculate() Dim i As Integer Dim TotalBroke As Variant Dim TotalProduction As Variant Dim intArraySizeY As Integer ' The size of Proficy array for time specified Dim strArrayRange As String ' Holds the Excel range of the Proficy array Worksheets("PIMS Calc").Activate 'Selects the old range based on the previous array size and clear the contents. strArrayRange = "A10:D" & Cells(4, 4).Value + 10 Range(strArrayRange).Select Selection.ClearContents ' Recalculate cell D2 for updated time period ActiveSheet.Calculate ' Set array size to the new total number of Proficy data points intArraySizeY = Cells(4, 4).Value ' Select the new range based on new array size. 4 is added to intArraySizeY to offset the data in ' the correct place on the spreadsheet. strArrayRange = "A10:D" & intArraySizeY + 9 Range(strArrayRange).Select ' Create an array with the exact number of Proficy data points. Selection.FormulaArray = "=PRFTestsData(R4C1,R6C2,R7C2,1,"""", 0,40,""RTIM"",""CODE"",""ESTAT"",""VAL"")" For i = 10 To (Cells(4, 4).Value + 10) If Cells(i, 3).Value = "Broke-Cns" Then TotalBroke = TotalBroke + Cells(i, 4).Value Else TotalProduction = TotalProduction + Cells(i, 4).Value End If Next i Worksheets("Sheet1").Cells(12, 4).Value = (TotalBroke + TotalProduction) / 2204 Worksheets("Sheet1").Cells(14, 4).Value = TotalBroke / 2204 Worksheets("Sheet1").Calculate Worksheets("Sheet1").Activate End Sub Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime 13 - type mismatch
In sheet PIMS Calc in column 4 (D) look for a value that is not a number.
That would cause the error you describe... -- HTH... Jim Thomlinson " wrote: hi, i am trying to fix a marco that has suddenly broken and the person who created no longer works for us. i am getting the type mismatch error on the following line. - any assistance would be great. TotalBroke = TotalBroke + Cells(i, 4).Value the whole module is below Sub BrokeProductionCalculate() Dim i As Integer Dim TotalBroke As Variant Dim TotalProduction As Variant Dim intArraySizeY As Integer ' The size of Proficy array for time specified Dim strArrayRange As String ' Holds the Excel range of the Proficy array Worksheets("PIMS Calc").Activate 'Selects the old range based on the previous array size and clear the contents. strArrayRange = "A10:D" & Cells(4, 4).Value + 10 Range(strArrayRange).Select Selection.ClearContents ' Recalculate cell D2 for updated time period ActiveSheet.Calculate ' Set array size to the new total number of Proficy data points intArraySizeY = Cells(4, 4).Value ' Select the new range based on new array size. 4 is added to intArraySizeY to offset the data in ' the correct place on the spreadsheet. strArrayRange = "A10:D" & intArraySizeY + 9 Range(strArrayRange).Select ' Create an array with the exact number of Proficy data points. Selection.FormulaArray = "=PRFTestsData(R4C1,R6C2,R7C2,1,"""", 0,40,""RTIM"",""CODE"",""ESTAT"",""VAL"")" For i = 10 To (Cells(4, 4).Value + 10) If Cells(i, 3).Value = "Broke-Cns" Then TotalBroke = TotalBroke + Cells(i, 4).Value Else TotalProduction = TotalProduction + Cells(i, 4).Value End If Next i Worksheets("Sheet1").Cells(12, 4).Value = (TotalBroke + TotalProduction) / 2204 Worksheets("Sheet1").Cells(14, 4).Value = TotalBroke / 2204 Worksheets("Sheet1").Calculate Worksheets("Sheet1").Activate End Sub Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mod and Int gives me a Runtime Error 13 -- Type mismatch. | Excel Programming | |||
Runtime Error 13 Type Mismatch | Excel Programming | |||
Runtime Error '13': Type mismatch | Excel Programming | |||
Runtime error 13 type mismatch ? | Excel Programming | |||
Runtime error 13 type mismatch ? | Excel Programming |