Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mod and Int gives me a Runtime Error 13 -- Type mismatch. Robert[_35_] Excel Programming 1 March 13th 07 02:22 PM
Runtime Error 13 Type Mismatch Arturo Excel Programming 1 January 31st 07 03:24 PM
Runtime Error '13': Type mismatch Linking to specific cells in pivot table Excel Programming 2 May 18th 05 07:34 PM
Runtime error 13 type mismatch ? JoeH[_18_] Excel Programming 1 September 25th 04 08:23 PM
Runtime error 13 type mismatch ? JoeH[_14_] Excel Programming 1 September 25th 04 04:57 PM


All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"