Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
the posting rules said to be very specific when posting so i'll try t
be as descriptive as possible. i'm working on an invoice for a friend' business and i'd like to add a lot of automation to the file. i go pretty much everything working but i'm stumped on a couple of issues this is what it does right. 1. the invoice number is set to increase each time the invoice templat is opened (programmed in the macro). 2. the current date is automatically displayed in the date box when th template is opened 3. when the user clicks 'save' or 'save as', it is either saved as th invoice number, or the invoice number is the default filename in th save as box, respectively. the problem is this... everytime the user opens one of the previou invoices, the macros continue to do their work. that means that whe invoice #102 is opened, it automatically increases the invoice number i managed to get the date to stay frozen when opening old invoices s the problem is half solved. here is my macro. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel A Boolean) Application.DisplayAlerts = False ThisWorkbook.SaveAs ThisWorkbook.Path & "\" & _ ThisWorkbook.Worksheets("Sheet1").Range("g14").Val ue & _ ".xls" Application.DisplayAlerts = True Set datehalter = Sheets("Sheet1").Range("g12") With datehalter .Value = Sheets("Sheet1").Range("g12") End With Set deincrement = Sheets("Sheet1").Range("F14") With deincrement .Value = 1 End With End Sub Sub Workbook_Open() Set ponum = Sheets("Sheet1").Range("g14") With ponum .Value = .Value + 2 End With ActiveWorkbook.Save End Sub to clarify any confusion, this is what's in the following cells. g12 = date f14 = "0" (my effort to solve the prob) g14 = invoice number i believe that the problem might be solved if i could find a command t enable certain macros if the filename is numberic, and other macros i the filename is text. any help would be greatly appreciated -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
problems copying invoice form but then changing to a different font | Excel Discussion (Misc queries) | |||
Help! having problems with macros/coding | Excel Discussion (Misc queries) | |||
Macros for invoice | Excel Worksheet Functions | |||
problems with macros | Excel Worksheet Functions | |||
Macros Problems | Excel Programming |