Results 1 to 11 of 11

Userform runs Initialize sub @ beginning of textbox AfterUpdate event w/out being called

Threaded View

  1. #1
    Registered User
    Join Date
    06-22-2016
    Location
    Minnesota
    MS-Off Ver
    2013
    Posts
    20

    Userform runs Initialize sub @ beginning of textbox AfterUpdate event w/out being called

    I have a textbox where I have setup some code in the AfterUpdate event that is intended to take the value entered into the box and "do stuff". I have struggled to get it to do stuff, and finally realized that one of the problems is because my me.textbox.value is always coming up empty even when there is text entered into the textbox on the form and I've pressed enter. I know very little about the step-through functions in VBA and finally figured out how to F8 my way through my textbox AfterUpdate sub. I discovered that the very first thing it does, before even making it to any of my "do stuff" code, is to run the userform initialize sub. In the initialize sub I had previously written code to explicity set the value of the textbox to "" so that it would be clear upon opening. What is tripping me up is that my textbox afterupdate sub does not call the Intialize sub anywhere in its code. Why is it making that jump?

    Below is the beginning of the AfterUpdate code, which is a hot mess right now because of all the different coding things I'd tried prior to discovering the null textbox value issue.

    Private Sub fPanelNumi_AfterUpdate()
     Dim testcell
     Dim i As Integer 'row position of a panel number
     Dim j As Integer 'the quantity of discrete values with a panel number string
     Dim k As Integer 'loop counter for the string values
     Dim m As Integer 'low value of a range in the panel number string
     Dim n As Integer 'high value of a range in the panel number string
     Dim forstopper As Boolean
     Dim nArray As Variant
     Dim nPanelArray As Range
     Dim RowCounter As Integer
     
     
     'fix this so that entering a part number doesn't pull in random data in instances such as when creating anew panel.
    If OBtnNewPanel.Value = True Then
        Else
            OBtnLoadPanelI.Value = True Or OBtnLoadPanelN = True
    End If
        
     'Make DataEntry active
     Worksheets("DataEntry").Activate
    
     RowCounter = WorksheetFunction.CountA(Range("D5:D200"))
    
    Set nPanelArray = Range("D5:D200")
     
    i = 1
    
    forstopper = True
        Do While i <= RowCounter And forstopper
            
            'MsgBox InStr("106-108", "-")
            Me.fPanelNumi.Value = Me.fPanelNumi.Text
            MsgBox Me.fPanelNumi.Value
            nArray = Split(nPanelArray(i, 1).Value, ",", , vbTextCompare)
            j = WorksheetFunction.CountA(nArray)
            k = 0
            Do While k <= j - 1 And forstopper 'This searches for a number within a string of comma delineated numbers, ex 106,107,108,109
                If InStr(nArray(k), "-") = 0 Then
                    If nArray(k) = fPanelNumi Then
    Thanks.
    Last edited by chirp08; 08-18-2016 at 12:13 PM. Reason: Trying to clean up explanations

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to deal with multiple sets of code in the Initialize Event of a userform
    By chin67326 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2015, 06:54 AM
  2. AfterUpdate Event triggered without updating the textbox
    By mschatteles in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2015, 02:24 PM
  3. [SOLVED] Userform called from another userform textbox - unload problem
    By barryleajo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-27-2013, 01:09 PM
  4. Unload UserForm Runs Initialize
    By McNultyK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2011, 11:51 AM
  5. Initialize Textbox on Userform
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2011, 01:55 PM
  6. AfterUpdate event for dynamic TextBox
    By moyo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2007, 02:23 AM
  7. [SOLVED] UserForm Initialize event doesn't fire reliably
    By RB Smissaert in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-15-2005, 09:41 PM

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