Attribute VB_Name = "Module1" Function LuvunJaollisuus(ByVal Luku As Long) As Long Attribute LuvunJaollisuus.VB_ProcData.VB_Invoke_Func = " \n14" Dim TmpB As Long If Luku Mod 10 = 0 Then TmpB = 10 ElseIf Luku Mod 9 = 0 Then TmpB = 9 ElseIf Luku Mod 8 = 0 Then TmpB = 8 ElseIf Luku Mod 7 = 0 Then TmpB = 7 ElseIf Luku Mod 6 = 0 Then TmpB = 6 ElseIf Luku Mod 5 = 0 Then TmpB = 5 ElseIf Luku Mod 4 = 0 Then TmpB = 4 ElseIf Luku Mod 3 = 0 Then TmpB = 3 ElseIf Luku Mod 2 = 0 Then TmpB = 2 ElseIf Luku Mod 1 = 0 Then TmpB = 1 End If LuvunJaollisuus = TmpB End Function Sub TeeBSarake() Attribute TeeBSarake.VB_ProcData.VB_Invoke_Func = " \n14" Dim Rivi As Long Rivi = 2 Do While Range("A" & Rivi).Value <> "" If IsNumeric(Range("A" & Rivi).Value) Then Range("B" & Rivi).Value = LuvunJaollisuus(Range("A" & Rivi).Value) End If Rivi = Rivi + 1 Loop End Sub