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.
Bookmarks