Hello all,
I have come to a dead end in attempting to solve my issue, so I turn to you all for help.
I have created a sequence of macros to manage our golfing group’s bimonthly eclectic scores. Although it is amateurish and inefficient, it works. However, I am attempting to tidy it up and I want to create a formula, using vlookup, that will recover the final scores of the players, that are on the current round worksheet, back to the master data worksheet. The name of the current round worksheet is a variable and this is where the problem lies.
Whilst I can see that the variable NewRoundLeaderboard is correctly constructed (by hovering the mouse over it), it does not show a value by hovering over it in the vlookup formula. When that line is executed, I get a Finder window with the message “Cannot find” NewRoundLeaderboard”. Copy from:”.
I have attempted different combinations of the ‘ (single apostrophe), “ (double apostrophe), & (ampersand) and spaces to get VBA to recognise that my variable NewRoundLeaderboard is the name of the worksheet but to no avail. Frustratingly, replacing the variable with the actual worksheet name (r2019.6Leaderboard) works OK.
I have also made other abortive attempts using Set (a range) and defining a Name. (range).
As a matter of interest, the value Template!r1c24 refers to a weeping emoji as I cannot find a way to create it directly.
I am using Mac OS 10.14.6 and Excel v16.32.
Any solutions would be gratefully appreciated.
I have come to a dead end in attempting to solve my issue, so I turn to you all for help.
I have created a sequence of macros to manage our golfing group’s bimonthly eclectic scores. Although it is amateurish and inefficient, it works. However, I am attempting to tidy it up and I want to create a formula, using vlookup, that will recover the final scores of the players, that are on the current round worksheet, back to the master data worksheet. The name of the current round worksheet is a variable and this is where the problem lies.
VBA Code:
Sub test()
'
Dim NewRound As String, NewRoundLeaderboard As String
Sheets("MasterData").Select
'Following 4 lines for test only
NewRound = "r2019.6"
NewRoundLeaderboard = NewRound & "Leaderboard"
FirstRowMasterData = 9
LastRowMasterData = 24
For i = FirstRowMasterData To LastRowMasterData
Cells(i, 4).FormulaR1C1 = "=if(isna(VLOOKUP(RC1,'NewRoundLeaderboard'!R11C1:R21C12,12,FALSE)),Template!r1c24,VLOOKUP(RC1,'NewRoundLeaderboard '!R11C1:R21C12,12,FALSE))"
Next
'
End Sub
I have attempted different combinations of the ‘ (single apostrophe), “ (double apostrophe), & (ampersand) and spaces to get VBA to recognise that my variable NewRoundLeaderboard is the name of the worksheet but to no avail. Frustratingly, replacing the variable with the actual worksheet name (r2019.6Leaderboard) works OK.
I have also made other abortive attempts using Set (a range) and defining a Name. (range).
As a matter of interest, the value Template!r1c24 refers to a weeping emoji as I cannot find a way to create it directly.
I am using Mac OS 10.14.6 and Excel v16.32.
Any solutions would be gratefully appreciated.