Forum Discussion

StickyVES's avatar
StickyVES
Copper Contributor
Oct 01, 2022

Assistance with a function applying to multiple worksheets

Hello!

I recently added a function that helps me track the last Cell I modified In my Timecard Worksheet:

=CELL("address")

It tells me the last column and row that I entered data into making it easier to track. The problem is, It works on all my worksheets in that workbook, which means if I enter something in my other worksheet: Data entry. The =CELL("address") cell in Timecard responds to that input in Timecard. Resulting in me losing my place. If there is some way for me to restrict a function to one worksheet I haven't been able to find it in my search. Hopefully I explained it well enough! 

Open for alternative solutions as well. Thanks.

  • StickyVES's avatar
    StickyVES
    Copper Contributor
    Someone said I should just put the name of the worksheet "Timecard" But I don't know where in the function to place it. =CELL("address").
    • HansVogelaar's avatar
      HansVogelaar
      MVP

      StickyVES

      What you want is not possible using the CELL function:

      • In the form =CELL("address") it will return the address of the active cell, on whichever sheet is the active sheet.
      • In the form =CELL("address",A1) or =CELL("address",Timecard!A1) it will return A1 instead of the address of the active cell.

      You might use VBA code to store the address of the last used cell on the Timecard sheet in a cell, but that has the undesirable side effect of disabling Undo on the Timecard sheet...

      • StickyVES's avatar
        StickyVES
        Copper Contributor
        I have a nasty habit of finding problematic issues like this. Thanks very much for the help!
  • DexterG_III's avatar
    DexterG_III
    Iron Contributor

    StickyVES Yes, without providing a reference =CELL("address",A1), it will return the address of the active cell regardless.  If you put in a reference the sheet name will be retained. 

     

     

    • StickyVES's avatar
      StickyVES
      Copper Contributor
      So A1 (or whichever cell I need it for), should be helping keep track of the cell I edit in a single sheet? It just makes it continually reference whichever cell I enter in the function and won't track my other entries.

      People appear to have the opposite issue than me it seems. They have trouble making functions work over multiple sheets. I can't get that code to stop referencing the other sheets. Even if I could get the last cell I modified change color or something, Then clear it when I enter something else.

Resources