Print Numbers - Serial - ODD - Even _ Prime

     

     

    Download The Workbook

     

    Sub Print_Numbers()
    'www.Tricks12345.Com
    Dim sh2 As Worksheet
    Set sh2 = ThisWorkbook.Sheets("Sheet2")

    sh2.UsedRange.Clear
    ActiveWindow.DisplayGridlines = False

    Dim i As Integer
    Dim MAX

    MAX = Application.InputBox("Enter the Numbers", "Print Numbers")
    j = 1: r = 1

    For i = 1 To MAX
    Cells(r, j).Activate
    With ActiveCell
    .Value = i
    .Font.Size = 18
    .Font.Name = "Footlight MT Light"
    .Font.ColorIndex = 10
    .Font.Bold = True
    End With
    If r = 10 Then
    ActiveCell.Font.ColorIndex = 5
    End If
    If r = 1 Then
    ActiveCell.Font.ColorIndex = 30
    End If
    r = r + 1
    If r > 10 Then
    j = j + 1
    r = 1
    End If
    Next
    End Sub

    Sub Print_Even_Numbers()
    'www.Tricks12345.Com

    Dim sh2 As Worksheet
    Set sh2 = ThisWorkbook.Sheets("Sheet2")

    sh2.UsedRange.Clear
    ActiveWindow.DisplayGridlines = False

    Dim i As Integer
    Dim MAX

    MAX = Application.InputBox("Enter the Numbers", "Print Numbers")
    j = 1: r = 1

    For i = 2 To MAX Step 2
    Cells(r, j).Activate
    With ActiveCell
    .Value = i
    .Font.Size = 18
    .Font.Name = "Footlight MT Light"
    .Font.ColorIndex = 10
    .Font.Bold = True
    End With
    If r = 10 Then
    ActiveCell.Font.ColorIndex = 5
    End If
    If r = 1 Then
    ActiveCell.Font.ColorIndex = 30
    End If
    r = r + 1
    If r > 10 Then
    j = j + 1
    r = 1
    End If
    Next
    End Sub

    Sub Print_ODD_Numbers()
    'www.Tricks12345.Com

    Dim sh2 As Worksheet
    Set sh2 = ThisWorkbook.Sheets("Sheet2")

    sh2.UsedRange.Clear
    ActiveWindow.DisplayGridlines = False

    Dim i As Integer
    Dim MAX

    MAX = Application.InputBox("Enter the Numbers", "Print Numbers")
    j = 1: r = 1

    For i = 1 To MAX Step 2
    Cells(r, j).Activate
    With ActiveCell
    .Value = i
    .Font.Size = 18
    .Font.Name = "Footlight MT Light"
    .Font.ColorIndex = 10
    .Font.Bold = True
    End With
    If r = 10 Then
    ActiveCell.Font.ColorIndex = 5
    End If
    If r = 1 Then
    ActiveCell.Font.ColorIndex = 30
    End If
    r = r + 1
    If r > 10 Then
    j = j + 1
    r = 1
    End If
    Next
    End Sub

    Sub Print_Prime_Numbers()
    'www.Tricks12345.Com

    Dim sh2 As Worksheet
    Set sh2 = ThisWorkbook.Sheets("Sheet2")

    sh2.UsedRange.Clear
    ActiveWindow.DisplayGridlines = False

    Dim i As Integer
    Dim MAX

    MAX = Application.InputBox("Enter the Numbers", "Print Numbers")
    j = 1: r = 1

    For i = 2 To MAX

    Cells(r, j).Activate
    ActiveCell.Value = i

    If i Mod 2 = 0 Then
    Cells(r, j) = ""
    End If

    If i Mod 3 = 0 Then
    Cells(r, j) = ""
    End If

    If i Mod 5 = 0 Then
    Cells(r, j) = ""
    End If

    If i Mod 7 = 0 Then
    Cells(r, j) = ""
    End If


    If i <= 2 Then
    Range("A1").Value = 2
    ElseIf i <= 3 Or i <= 4 Then
    Range("A1").Value = 2
    Range("A2").Value = 3
    ElseIf i = 5 Then
    Range("A1").Value = 2
    Range("A2").Value = 3
    Range("A3").Value = 5
    ElseIf i = 7 Then
    Range("A1").Value = 2
    Range("A2").Value = 3
    Range("A3").Value = 5
    Range("A4").Value = 7
    End If



    If Cells(r, j).Value <> "" Then
    With ActiveCell
    .Font.Size = 18
    .Font.Name = "Footlight MT Light"
    .Font.ColorIndex = 10
    .Font.Bold = True
    End With
    r = r + 1
    End If


    If r > 10 Then
    j = j + 1
    r = 1
    End If
    Next
    End Sub