Hello All,
I'm a self-taught VBA novice (thanks to excellent sites such as Mr. Excel) and I am working on creating a GUI for a spreadsheet I've been keeping of units my team ships out. In my spreadsheet, I have a formula that performs a Vlookup for the model number of a unit shipped if the part number is entered. This formula looks at a different worksheet and returns the values requested. I'm trying to translate this into the VBA Userform but keep getting the 1004 error and Excel keeps crashing. Maybe you guys could help me out? Here's the code I'm working with:
Private Sub CompanyPN_AfterUpdate()
'Transfer is a global variable, defined as a range
With Application.WorksheetFunction
Transfer.Value = .VLookup(CompanyPN.Value, ThisWorkbook.Worksheets("Table of Loggers").Range("A:B"), 2, False)
End With
ModelNumber.Value = Transfer.Value 'untested, want to get the VLookup to work first
End Sub
Basically, I have a text field called CompanyPN where I'm entering my part number. I want to populate another text field, ModelNumber, based on these results in my UserForm. Please help if you can!
Thanks,
Alex
Bookmarks