No fluff code version with explanations:
Private Sub btnViewVendor_Click()
Dim ventu As Range, rven As Long
Set ventu = Worksheets("Vendors").Range("VendorList")
rven = ventu.Rows.Count
With ventu
Set ventu = ventu.Resize(rven, 1).Offset(1, 0): ventu.Name = "Vendor"
End With
'####NONE OF THAT CODE ABOVE SHOULD HAVE ANY BEARING ON THE CODE BELOW
'####I CAN JUST AS EASILY MAKE RVEN = Worksheets("Vendors").Range("VendorList").Rows.Count AND STILL GET THE VALUE OF 29.
'####VENDORLIST IS A NAMED RANGE ON THE SHEET VENDOR.
SpinButton1.Value = rven '####ERROR HERE####
'####THIS CODE BELOW IS IRRELEVANT TO THE PROBLEM. I CAN COMMENT IT OUT AND WILL STILL GET THE ERROR
ListBox1.ListIndex = SpinButton1.Value - 1
txtVendorName.Value = ListBox1.Value
End Sub
EDIT: Ahh, the little things... I had set a listbox1.listindex to spinbutton1.value on form initialize, so when the value of the spinner was over the listbox it was tied to, the listbox was actually causing the error to the spinner which was causing the error in that section of the code.
Looks like problem solved.
Bookmarks