![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|