I am getting type mismatch error Run time error'13

tiger123

New Member
Joined
Jun 24, 2014
Messages
37
Code:
Private Sub CommandButton1_Click()
Dim LR As Long
    Dim Dash As Long, _
        Whole As Double
   ' Dim pi ', WorkSheets, Range
    WorkSheets("Sheet3").Select
LR = Sheets("Sheet3").Cells(Rows.Count, "A").End(xlUp).Row
    For r = 2 To LR
      s = Cells(r, 3)
      arr = Split(s, ",")
      For i = LBound(arr) To UBound(arr)
        Whole = 0
        p = InStr(arr(i), " IN")
        If p > 0 Then


           ' dostuff
       End If
        Dash = InStr(frac, "-")
        If Dash > 0 Then
            Whole = Left(frac, Dash - 1)
            frac = Mid(frac, Dash + 1, Len(frac))
        End If
        af = Right(arr(i), Len(arr(i)) - p + 1)
         evfrac = Whole + Left(CStr(Evaluate(frac)), 5)  ---> error in this  line
      '  evfrac = Whole + Format(Evaluate(frac), "0.###")
        ss = ss & evfrac & af & ", "
      Next i
      Cells(r, 4) = Left(ss, Len(ss) - 2)
      ss = ""
    Next r
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
@sktneer,

Please note rule 16 regarding 'back seat moderation'. Thanks.
 
Upvote 0
That's OK - I know it gets confusing with all forums having slightly different ways of doing things. ;)
 
Upvote 0
Yes. That is very correct. As you can see I have only 30 posts here so far and it just happened unknowingly. ;)
 
Upvote 0

Forum statistics

Threads
1,215,352
Messages
6,124,455
Members
449,161
Latest member
NHOJ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top