Consulting

Results 1 to 4 of 4

Thread: An Ify statment in macro module

  1. #1
    VBAX Regular Erays's Avatar
    Joined
    Mar 2005
    Posts
    73
    Location

    Question An Ify statment in macro module

    I want the macro to let me know when there is mre than 5 and then when there is less than 5 and let me know when there is 5 Then I can add the other macros to run with the if's


    Sub Macro911()
    If Len(A3) = 5 Then
    MsgBox ("You have entered 5 characters.")
    ElseIf Len(A3) > 5 Then
    MsgBox ("You have entered More than 5 characters.")
    ElseIf Len(A3) < 5 Then
    MsgBox ("You have entered 5 characters.")
    End If
    End Sub
    Help would be greatly appreciated!
    Last edited by Erays; 09-28-2005 at 01:05 PM. Reason: adding the spread sheet

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Try this.


    Sub Macro911()
    If Len(Range("A3").Text) = 5 Then
            MsgBox ("You have entered 5 characters.")
        ElseIf Len(Range("A3").Text) > 5 Then
            MsgBox ("You have entered More than 5 characters.")
        Else
            MsgBox ("You have entered " & Len(Range("A3").Text) & " characters.")
        End If
    End Sub

  3. #3
    VBAX Regular Erays's Avatar
    Joined
    Mar 2005
    Posts
    73
    Location
    Thank you so much>.

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You're Welcome

    Take Care

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •