ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 6,002
- Office Version
- 2024
- Platform
- Windows
Hi,
I forever having to type - into a text box.
Is there some code workaround to do this for me.
Example.
I would type 12345-ABC-678
With the code i would just type 12345ABC678
The - is always in the same place,so position 6 & 10
Below is the code for the text box i type it into.
I forever having to type - into a text box.
Is there some code workaround to do this for me.
Example.
I would type 12345-ABC-678
With the code i would just type 12345ABC678
The - is always in the same place,so position 6 & 10
Below is the code for the text box i type it into.
Code:
Private Sub MyPartNumber_AfterUpdate()
If MyPartNumber.Text = "" Then Exit Sub
'Check to see if value exists
If WorksheetFunction.CountIf(Sheet8.Range("Y:Y"), Me.MyPartNumber.Value) = 0 Then
MsgBox "NON STOCK ITEM TRY LINGS"
Me.MyPartNumber.Value = ""
Me.MyPartNumber.SetFocus
Exit Sub
End If
'Lookup values based on first control
With Me
.HondaPartNumber = Application.WorksheetFunction.VLookup(Me.MyPartNumber, Sheet8.Range("HONDAORIGINALNUMBERS"), 2, 0)
.NumbersOnCase = Application.WorksheetFunction.VLookup(Me.MyPartNumber, Sheet8.Range("HONDAORIGINALNUMBERS"), 3, 0)
.NumbersOnPcb = Application.WorksheetFunction.VLookup(Me.MyPartNumber, Sheet8.Range("HONDAORIGINALNUMBERS"), 4, 0)
.Buttons = Application.WorksheetFunction.VLookup(Me.MyPartNumber, Sheet8.Range("HONDAORIGINALNUMBERS"), 5, 0)
.GoldSwitchesOnPcb = Application.WorksheetFunction.VLookup(Me.MyPartNumber, Sheet8.Range("HONDAORIGINALNUMBERS"), 6, 0)
.ItemType = Application.WorksheetFunction.VLookup(Me.MyPartNumber, Sheet8.Range("HONDAORIGINALNUMBERS"), 7, 0)
End With
End Sub