(Solved) – Type mismatch error VBA when taking input from form


My code runs as I want and it performs the action I want as well but I am still getting a type mismatch error, is there any way I can fix it? I get the error on If ((min Or max) < 0) Then

Dim i As Integer
Dim sym As String
Dim min As String
Dim max As String
Dim intMin As Integer
Dim intMax As Integer

For i = 1 To 10
    sym = Me.Controls("TextBox" & i).Value
    min = Me.Controls("TextBox" & (i   10)).Value
    max = Me.Controls("TextBox" & (i   20)).Value

    **If ((min Or max) < 0) Then**
    MsgBox "Negative fractions cannot be inputted"
    End If

    If (min > max) Then
    MsgBox "min fraction cannot be greater than max"
  End If

    If (min >= 100) Then
    MsgBox "min must be less than or equal to 100"

     .Cells(lRow   i, 1).Value = sym
     .Cells(lRow   i, 2).Value = min
     .Cells(lRow   i, 3).Value = max
    End If

Next i

End With

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *