+ Reply to Thread
Results 1 to 2 of 2

how to create macro in excel to disallow imput of numbers

  1. #1
    Registered User
    Join Date
    03-05-2005
    Posts
    2

    how to create macro in excel to disallow imput of numbers

    i would like to know how to create macro in excel to disallow input of numbers by the user. the user is allow to enter characters except numbers. pls list the steps to guide me through. thank you

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Yummy,

    This code will prevent the user from entering anything but text on the worksheet and display a message to the user that only text is allowed. Put this code in the Worksheet's Change Event. If you need help with this, contact me either by private message or e-mail me at LeithRoss@aol.com. This code can be modified to allow numbers to be input only in seelcted cells or ranges.
    _________________________________________________________________

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)

    Test = WorksheetFunction.IsNumber(Target.Value)

    If Test = True Then
    MsgBox "You may only EnterText !", vbExclamation + vbOKOnly
    Target.Value = ""
    Range(Target.Address).Select
    End If

    End Sub
    _________________________________________________________________

    Should work fine,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1