Carlit007
New Member
- Joined
- Sep 5, 2018
- Messages
- 47
- Office Version
- 2019
- 2016
- 2013
- Platform
- Windows
- MacOS
I Have created a user form that auto populate fields 2-11 with data from the range on sheet1 ("Data12").
all of this is based on the Serial number inputted into form field number #1 which is a dropdown list that uses the range in colum 1 of the sheet which holds all the other data
the only problem I am having is data mismatch because the serial number is not always just numbers sometimes there's a mix of letters and numbers.
I keep getting the error runtime error 1004 is there any way to make it so that my variable is flexible to be numerical value as well as mixed
I have tried both the Vlookup method and index and match but keep running into the same issues
below is a snipped of the code that I am using any help with this would be deeply appreciated
all of this is based on the Serial number inputted into form field number #1 which is a dropdown list that uses the range in colum 1 of the sheet which holds all the other data
the only problem I am having is data mismatch because the serial number is not always just numbers sometimes there's a mix of letters and numbers.
I keep getting the error runtime error 1004 is there any way to make it so that my variable is flexible to be numerical value as well as mixed
I have tried both the Vlookup method and index and match but keep running into the same issues
below is a snipped of the code that I am using any help with this would be deeply appreciated
VBA Code:
Private Sub CBserial_Change()
Dim Findrow As Long
Dim SerialNumber As Variant
SerialNumber = Me.CBserial.Text 'this holds the Serial Number data which could be both a number or mixed value
Findrow = WorksheetFunction.Match(SerialNumber, Sheets("Data12").Range("A:A"), 0)
TextBox1.Text = Cells(Findrow, 2) 'LIN
TextBox2.Text = Cells(Findrow, 3) 'MATERIAL #
TextBox3.Text = Cells(Findrow, 4) 'ADMIN #
TextBox4.Text = Cells(Findrow, 5) 'DESCRYPTION
TextBox5.Text = Cells(Findrow, 6) 'LOCATION
End Sub