Attribute VB_Name = "Module1" Private Function PvmOK(ByVal PvmKokeilu As Variant) As Boolean Dim TmpB As Boolean TmpB = False If IsEmpty(PvmKokeilu) Then TmpB = False Else If IsDate(PvmKokeilu) Then TmpB = True Else TmpB = False End If End If PvmOK = TmpB End Function Private Function KerroinOK(ByVal KerroinKokeilu As Variant, _ ByVal TyhjaArvoNollaksi As Boolean) As Boolean Dim TmpB As Boolean If IsEmpty(KerroinKokeilu) Then If TyhjaArvoNollaksi Then TmpB = True Else TmpB = False End If Else If IsNumeric(KerroinKokeilu) Then TmpB = True Else TmpB = False End If End If KerroinOK = TmpB End Function Private Function Tarkistukset() Dim ArvoPvm As Variant Dim ArvoLuku As Variant Dim TmpB As Boolean TmpB = True ArvoPvm = ThisWorkbook.Sheets(1).Range("A1").Value ArvoLuku = ThisWorkbook.Sheets(1).Range("B1").Value If Not PvmOK(ArvoPvm) Then TmpB = False If Not KerroinOK(ArvoLuku, False) Then TmpB = False Tarkistukset = TmpB End Function Private Sub Laskenta() MsgBox "Tarkistukset oikein, aloitetaan laskenta" End Sub Public Sub Main() If Tarkistukset Then Laskenta End Sub