LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Calling a sub

Someone else posted this really useful code for validating textboxes:

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57 'numbers
Case Else 'Discard anything else
Beep
KeyAscii = 0
End Select
End Sub

Only problem is that I have numerous textboxes to check and I've currently
listed this for every box.

How do I package this so that for each textbox I can use something similar to:

Private Sub txtBankNum4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Call NumCheck
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling C# DLL from VBA Paul Excel Programming 3 November 4th 06 07:29 PM
Calling an XLL from VB? Maury Markowitz Excel Programming 7 October 19th 06 02:43 PM
Need Help Using/Calling DLL Please Trip[_3_] Excel Programming 0 January 8th 06 09:57 AM
Calling an Add-In BillCPA Excel Discussion (Misc queries) 2 August 11th 05 09:32 PM
Calling SUB Peter Longstaff Excel Programming 2 February 23rd 04 08:04 PM


All times are GMT +1. The time now is 09:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"