Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5976849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:17:12+00:00 2026-05-22T21:17:12+00:00

im trying to check if a number is a text or number in a

  • 0

im trying to check if a number is a text or number in a banking system. If the value is incorrect it should erase and send an error message, but my code isnt working at all… can someone help me? here is the code:

Private Sub TextBox1_Change()

   name = TextBox1

   If Application.IsText(name) = True Then
      IsText = True
   Else
      MsgBox "Insert only words"
      Selection.name.Delete
   End If

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:17:13+00:00Added an answer on May 22, 2026 at 9:17 pm

    I think you should be using name = TextBox1.Text instead. It’s probably giving you an error on that line.

    Also, you may want to wait until the user is finished typing the response, I believe the changed event will run each time a character is pressed. The AfterUpdate will run after you tab or click away from the textbox.

    And really, instead of deleting the response (which I don’t think will work), you should simply set the textbox blank back to an empty string.

    Private Sub TextBox1_AfterUpdate()
        If Not MyIsANumber(TextBox1.Text) Then
            MsgBox ("It's Text")
        Else
            TextBox1.Text = ""
        End If
    End Sub
    
    Function MyIsANumber(str As String) As Boolean
        For i = 1 To Len(str)
            If IsNumeric(Mid(str, i, 1)) Then
               MyIsANumber = True
               Exit Function
            End If
        Next
            MyIsANumber = False
     End Function
    

    I’m sure the code could be structured better, but there’s something along the lines of what you need. In this case, it just wipes the textbox if there is a number entered. Obviously, things will need to be the opposite for your textbox that you want to contain a number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to check if a value I read from a text file
I'm trying to check if each number in a list is evenly divisible by
I am trying to find the fastest way to check whether a given number
I'm trying to check network available or not. But in my emulator it always
I am trying to send an email message with data collected from an html
I'm trying to extract the number from a text string and join it to
Im trying to write batch file code to check whether given line is present
I am trying to code a error callback using php and ajax. What I
I am trying to check if a string is numeric but in vain. here
Trying to write a script that will check the value in the form is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.