I'm trying to generate 3 lists on one page that shows the A:A range of the previous 3 day's sheets using the INDIRECT formula and concatenation(eg: INDIRECT("'" & B2 & "'!A2") where B2 would equal the name of t, but I need to pull the name of the prior day's sheet (eg: 10-17) into cell B2.
I've got a working function that can find the value of a cell in another sheet by relative location, but I can't seem to get the sheet name by relative position.
Function NextSheet(rCell As Range)
Application.Volatile
Dim i As Integer
i = rCell.Cells(1).Parent.Index
NextSheet = Sheets(i + 3).Range(rCell.Address)
End Function
and another function that can return the sheet name of the sheet:
Function SheetName(rCell As Range, Optional UseAsRef As Boolean) As String
Application.Volatile
If UseAsRef = True Then
SheetName = "'" & rCell.Parent.Name & "'!"
Else
SheetName = rCell.Parent.Name
End If
End Function
But I can't seem to use them together (ie: NextSheet(SheetName(A2)), or SheetName(NextSheet(A2)) Is there a similar function I could use to return the sheet name by relative position?
Secondary question: Can I not call a user created function inside of another user created function like that, or are they just not set up correctly to be called inside each other?