counter in excel ?

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: counter in excel ?

  1. #1
    Guest

    Default

     
    How can I put in a counter in the folder, it may be visible, and save it ? What I'd like to become is, next time I open a new folder the counter should be increased by one, only when I've saved the previous one. Macro's ?

    Thanx

  2. #2
    MrExcel MVP lenze's Avatar
    Join Date
    Feb 2002
    Location
    Helena, MT
    Posts
    13,690
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    This should do what you want

    First, Define a Named Range "Counter" in you excel Worksheet

    Then, place this code in the ThisWorkbook module.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    Dim myCounter As Variant

    myCounter = Range("Counter").Value
    myCounter = myCounter + 1
    Range("Counter").Value = myCounter

    End Sub

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com