input within a textbox in VBA

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • avocursist59lok1

    input within a textbox in VBA

    Hello,
    I'm busy with VBA in excel.
    Does anybody know how to control the input within a textbox? For example, a
    textbox must contain only numbers and no text. The program must give a
    warning if you type text in the textbox.

    Greetings,
    Hans


  • Ken Horiski

    #2
    Re: input within a textbox in VBA

    In VBA, you need to create an 'on change' event for that control. Each time
    the user modifies the contents of the textbox, you can use
    isnumeric(yourc ontrolname.text ) = True to determine if the input is valid.
    If the input is not numeric, you can issue a warning message to a label or
    message box. Then I would use yourcontrolname .setfocus to highlight the
    contents of that text box.

    Hope this helps.



    "avocursist59lo k1" <avocursist59lo k1@avo-bedrijf.nl> wrote in message
    news:3f2919be$0 $49100$e4fe514c @news.xs4all.nl ...[color=blue]
    > Hello,
    > I'm busy with VBA in excel.
    > Does anybody know how to control the input within a textbox? For example,[/color]
    a[color=blue]
    > textbox must contain only numbers and no text. The program must give a
    > warning if you type text in the textbox.
    >
    > Greetings,
    > Hans
    >
    >[/color]


    Comment

    Working...