Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry I guess I am to dumb to understand I could n't get it to work
Thansk So Much Both of you God Bless "Jim" wrote: I tried that code, then formatted cell B2 like Carim said. I had to comment out the other formatting code then it worked nicely. Also, i noticed you have to delete value from cell B2 before saving else the macro wont find it "empty" and will not work. Private Sub Workbook_Open() Const sAPPNAME As String = "Excel" Const sSECTION As String = "Invoice" Const sKEY As String = "Invoice_key" Const nDEFAULT As Long = 1& Dim nNumber As Long With ThisWorkbook.Sheets("Invoice") With .Range("B1") If IsEmpty(.Value) Then .Value = Date .NumberFormat = "dd mmm yyyy" End If End With With .Range("B2") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPNAME, sSECTION, _ sKEY, nDEFAULT) '.NumberFormat = "@" .Value = nNumber ' Format(nNumber, "000000") SaveSetting sAPPNAME, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub Jim Carim wrote: Greg, Once you got the sequence number working, you can easily format it as follows : Format Cell Number Custom : "MT"00000 and it will produce your result. HTH Cheers Carim |