Build it up in pieces formatting each piece the way you want:
dim myStr as string
mystr = format(myYear,"0000") & _
format(mymonth,"00") & _
format(myday,"00") & _
and so on....
If that date is one field, you could use:
mystr = format(mydate,"yyyymmdd") & _
and so on...
If you're using worksheet formulas:
=text(a1,"yyyymmdd")&text(b1,"0000")&....
wrote:
Hi,
I'm recreating a "transID" made up of year,month, date,branch,
transaction number in the mainframe. The excel data contains all these
fields, but I've had to use formatcellscustom00000 to ensure the
transaction number has leading zeros.
I'm trying to concatenate these fields, but the transaction number
reverts back no leading zeros, so what should be 2006010511100123,
looks like 200615111123.
I need to exactly replicate the "transID"
Any ideas ?
Rich
--
Dave Peterson