View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
external usenet poster
 
Posts: 139
Default How Can I conver date i.e 18/11/2005 to 18112005.?

Manish :

reference Workbook_BeforePrint

add this code to Thisworkbook

if range("A1") is empty


'Thisworkbook
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("A1") = "" Then
n = 1
Else
s = VBA.Split(Range("A1"), "-")
n = s(1) + 1
End If
Range("A1") = VBA.Format(Date, "ddmmyy") & "-" & n
End Sub



--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Manish Patel" wrote:

Hi

I am doing one Pruchase Order form in Excel.

I want to creat the PO number as if date being Displayed in regular number.
i.e 18/11/2005 as if 18112005 and than followed by "-" and increasing value.

If I will open and print off 5 times in a day. The last number has to be
18112005-5.

Is there anybody can help me on it.

Kind Regards

Manish