![]() |
![]() |
|
|||||||
| 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 |
|
New Member
Join Date: Apr 2002
Posts: 6
|
I have worksheet called Test.xls. There is a marco called Getdate which is used to get data from other spreedsheet. I want to save this worksheet with some number whenever it saves. Just i would like to have a sequential number to this worksheet.
Thanks |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
Might not be the best way, but here's something quick and dirty...
Private Sub Workbook_Open() Cells(1, 1).Value = Cells(1, 1).Value + 1 End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) ThisWorkbook.SaveAs ("C:test" & Cells(1, 1).Value & ".xls") End Sub So every time the workbook is opened, the value in A1 will be incremented by 1. Then, before the workbook is closed, the vba code saves it as test + whatever a1's value is... Might get you started anyway. You could always hide the column or row that holds your incrementing value..
__________________
How long a minute is depends on which side of the bathroom door you are standing... Cheers |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|