Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Making a counter go up by 1 (https://www.askmehelpdesk.com/showthread.php?t=226097)

  • Jun 12, 2008, 11:16 AM
    Samantha_92
    Making a counter go up by 1
    How do I make an Excel Table update every time I use it?

    e.g -----> 1 2 3 4 whenever I use it

    Any help is appreciated.
  • Jun 12, 2008, 02:26 PM
    JBeaucaire
    1 Attachment(s)
    Try this macro.

    Press Alt + F11 > select ThisWorkbook > paste in the code below. Every time you open the file it will increment cell A1 in Sheet 1 (change the reference A1 to whichever cell where you want this to happen)

    Excel -- VBA -- Adding Code to a Workbook


    Code:

    Public Sub Workbook_Open()
      Dim Rng As Range
      Set Rng = ThisWorkbook.Sheets(1).Range("A1")
     
        With Rng
            .Value = .Value + 1
        End With
       
    End Sub


  • All times are GMT -7. The time now is 11:25 PM.