Hi,
I am trying to put together a real simple Userform for a Excel spreadsheet that basically holds scores, I have a combobox and 10 other text boxes on a userform . The combobox is pulling the player names then all I want is for the name selected to then populate the text boxes with the information from the information in the corresponding columns C to L right of the PlayerName on the worksheet, the scores can then be reviewed and updated before posting back at the moment all I am trying to do is get the first box to populate then go from there.
When I select the name I am getting Runtime Error 1004 - Method 'Range' of runtime object '_Worksheet' failed.
I have searched and found many suggestions on this error and tried several things changing all the cells to text and changed from Application.Worksheet.VLookup to how it looks now? Same 1004 error at same point.
I am sure its must be obvious but I cant seem to see the wood for the trees?
All the data on the worksheet is incorporated in a table - Table1, The Player Name is pulled from Column A which is marked as a Table - Player
This the line the debugger is taking me to, and I suspect its the ws.Range("Table1") thats my issue but I cant get my head round the issue
Any help would be very much appreciated
Thanks
Mark
I am trying to put together a real simple Userform for a Excel spreadsheet that basically holds scores, I have a combobox and 10 other text boxes on a userform . The combobox is pulling the player names then all I want is for the name selected to then populate the text boxes with the information from the information in the corresponding columns C to L right of the PlayerName on the worksheet, the scores can then be reviewed and updated before posting back at the moment all I am trying to do is get the first box to populate then go from there.
When I select the name I am getting Runtime Error 1004 - Method 'Range' of runtime object '_Worksheet' failed.
I have searched and found many suggestions on this error and tried several things changing all the cells to text and changed from Application.Worksheet.VLookup to how it looks now? Same 1004 error at same point.
I am sure its must be obvious but I cant seem to see the wood for the trees?
All the data on the worksheet is incorporated in a table - Table1, The Player Name is pulled from Column A which is marked as a Table - Player
VBA Code:
Private Sub UserForm_Initialise()
cmbPlayerName.List = Worksheets("Scores").Range("Player").Value
End Sub
Private Sub cmbPlayerName_Change()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Scores")
With Me
.txtHcp = Application.VLookup(Me.cmbPlayerName, ws.Range("Table1"), 3, False)
End With
End Sub
This the line the debugger is taking me to, and I suspect its the ws.Range("Table1") thats my issue but I cant get my head round the issue
Any help would be very much appreciated
Thanks
Mark