Subscribe now and choose from over 30 free gifts worth up to £49 - Plus get £25 to spend in our shop
Topic starter
Trying to get a specific cell on each worksheet to display its unique index number (1, 2, 3 etc.)
So far I have “=sheetnum()” in the cell with the module...
Function SheetNum() As Integer
SheetNum = ActiveSheet.Index
End Function
This always shows the index number of the last active sheet, so assuming that the “activesheet” bit needs to change – or am I way off/over-thinking things?
Posted : 03/03/2014 3:57 pm
What have we become eh?
😛
Posted : 03/03/2014 3:59 pm
Topic starter
Slow day!!
Posted : 03/03/2014 4:07 pm
You need to pass it a cell or range from the WS eg:
Public Function SheetIndex(ByRef Cells As Range) As IntegerSheetIndex = Cells.Worksheet.index
End Function
Called by =sheetindex(E32) in a cell
The E32 is irrelevant, just use any cell in that sheet
Posted : 03/03/2014 4:10 pm
Topic starter
Perfect, thanks 🙂
Posted : 04/03/2014 1:02 pm
