#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default Help

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"