Hi,
I'd like to ask, why is it not working?
Private Sub convert_Click()
Dim sMin, sSec As String
Dim iMin, iSec, iMinSec As Integer
sMin = UserForm2.inpMenit.Value
sSec = UserForm2.inpSec.Value
If sMin = "" Or sSec = "" Then
MsgBox "Please fill all input boxes"
ElseIf IsNumeric(sMin) = False Or IsNumeric(sSec) = False Then
MsgBox "Please input number only"
Else
iMin = CInt(sMin)
iSec = CInt(sSec)
iMinSec = MINSEC(iMin, iSec)
UserForm2.outCnt.Value = iMinSec
End If
End Sub
Public Function MINSEC(inputMin As Integer, inputSec As Integer) As Integer
MINSEC = inputMin * 60 + inputSec
End Function
It said there was a type mismatch in "iMinSec = MINSEC(iMin, iSec)". I already used "CInt" to convert string to integer, but still not working. When I tried to replace iMin, iSec with some integer, it worked.
Thanks for your help.
I'd like to ask, why is it not working?
Private Sub convert_Click()
Dim sMin, sSec As String
Dim iMin, iSec, iMinSec As Integer
sMin = UserForm2.inpMenit.Value
sSec = UserForm2.inpSec.Value
If sMin = "" Or sSec = "" Then
MsgBox "Please fill all input boxes"
ElseIf IsNumeric(sMin) = False Or IsNumeric(sSec) = False Then
MsgBox "Please input number only"
Else
iMin = CInt(sMin)
iSec = CInt(sSec)
iMinSec = MINSEC(iMin, iSec)
UserForm2.outCnt.Value = iMinSec
End If
End Sub
Public Function MINSEC(inputMin As Integer, inputSec As Integer) As Integer
MINSEC = inputMin * 60 + inputSec
End Function
It said there was a type mismatch in "iMinSec = MINSEC(iMin, iSec)". I already used "CInt" to convert string to integer, but still not working. When I tried to replace iMin, iSec with some integer, it worked.
Thanks for your help.