Home Forums Chat Forum Excel Help – Sheet Indexes

Viewing 5 posts - 1 through 5 (of 5 total)
  • Excel Help – Sheet Indexes
  • Haze
    Full Member

    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?

    scruff
    Free Member

    What have we become eh?

    😛

    Haze
    Full Member

    Slow day!!

    footflaps
    Full Member

    You need to pass it a cell or range from the WS eg:

    Public Function SheetIndex(ByRef Cells As Range) As Integer

    SheetIndex = Cells.Worksheet.index

    End Function

    Called by =sheetindex(E32) in a cell

    The E32 is irrelevant, just use any cell in that sheet

    Haze
    Full Member

    Perfect, thanks 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Excel Help – Sheet Indexes’ is closed to new replies.