Results 1 to 8 of 8

Userforms: Run same code when enter any textbox

Threaded View

Macdave_19 Userforms: Run same code when... 12-16-2009, 06:27 AM
royUK Re: Userforms: Run same code... 12-16-2009, 06:32 AM
Macdave_19 Re: Userforms: Run same code... 12-16-2009, 06:36 AM
royUK Re: Userforms: Run same code... 12-16-2009, 06:45 AM
romperstomper Re: Userforms: Run same code... 12-16-2009, 06:49 AM
Macdave_19 Re: Userforms: Run same code... 12-16-2009, 07:11 AM
romperstomper Re: Userforms: Run same code... 12-16-2009, 08:48 AM
royUK Re: Userforms: Run same code... 12-16-2009, 07:09 AM
  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question Userforms: Run same code when enter any textbox

    Hi There,

    i have 15 textboxes in my userform (all with tags).

    instead of having 15 seperate sub routines that call on one macro is there a way i can write some code that, on entering any texbox within a form, a specific routine would be called

    i tried using the Userform_click sub like so, but with no joy:

    Private Sub UserForm_Click()
    Dim Octrl As Control
    
    Octrl = Me.ActiveControl
    
    If TypeOf Octrl Is MSForms.TextBox Then
        Select Case Len(Octrl.TAG)
            Case 2
                ControlSub
            Case Else
                'Do Nothing
        End Select
    End If
    End Sub
    i appreciate any help on this

    thansk for reading and for any help offered

    cheers
    Last edited by Macdave_19; 12-16-2009 at 08:51 AM.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

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