DDRA Steampunk
New Member
- Joined
- Feb 10, 2017
- Messages
- 23
What am I doing wrong?
I'm using a custom function
That makes it so I can create the formula in Cell P1 to return the name of the event on the next page
and in Q1 return the day of event count from the next sheet (which is the previous show date).
I can then use them to pull up and compare the current and next sheet names and get
B1 is the current sheet name derived by
It must be derived this way because each tab has the date plus the event name. The formula therefore automatically checks if the event names match, and if so takes Q1 and adds 1 to that number, if not it sets the current day count to 1.
The formula works... sort of. First it gave me a circular ref warning and refused to update, so I allowed iterative calculations, then it started doing this weird thing where every time I save the file it adds 1 to whatever was in Q1 previously and sets P1 to whatever is on the first sheet in the sequence. When I go through all of the pages starting at the last page and hit "calculate page" it fixes all of the numbers and page references to the correct result until I try to save the file where the loop starts over.
I think it's something wrong in the structure of the function, but I can't seem to figure it out. I tried saving the code on individual pages but that didn't seem to make any difference.
Fixes or other ways of doing this are both welcome
I'm using a custom function
Code:
Function NxtShtNm() As String
Application.Volatile
NxtShtNm = ActiveWorkbook.Sheets(ActiveSheet.Index + 1).Name
End Function
Code:
=IFERROR(INDIRECT("'"&NxtShtNm()&"'!"&"b$1"),0)
Code:
=IFERROR(INDIRECT("'"&NxtShtNm()&"'!"&"e$1"),0)
Code:
=IF(B1<>P1,1,Q1+1)
Code:
=(MID(CELL("Filename",A1),SEARCH("]",CELL("Filename",A1),1)+12,32))
The formula works... sort of. First it gave me a circular ref warning and refused to update, so I allowed iterative calculations, then it started doing this weird thing where every time I save the file it adds 1 to whatever was in Q1 previously and sets P1 to whatever is on the first sheet in the sequence. When I go through all of the pages starting at the last page and hit "calculate page" it fixes all of the numbers and page references to the correct result until I try to save the file where the loop starts over.
I think it's something wrong in the structure of the function, but I can't seem to figure it out. I tried saving the code on individual pages but that didn't seem to make any difference.
Fixes or other ways of doing this are both welcome