Thread: Code Needed
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
jamescox[_51_] jamescox[_51_] is offline
external usenet poster
 
Posts: 1
Default Code Needed


If you want a text representation of the date in your Excel cell, try

format(cdate(Trim(Me.TxtDate.Value)),"dd/mm/yyyy")

or

format(cdate(Trim(Me.TxtDate.Value)),"dd/m/yyyy")

if you don't want a two-digit month.

If you want a date in the cell, use

cdate(Trim(Me.TxtDate.Value))

Actually, the Trim is probably overkill, since the CDate VBA function
is pretty good about converting anything even remotely resembling a
string format for a date into an Excel date.

There is a family of the "C" conversion functions in VBA - search in
the Object Browser for CDate and you'll get a reference to them all...

BTW, if all those writes to the worksheet are making things pretty
slow, check into assigning the values from the userform to elements of a
Variant array and then setting your workbook range to that array - much
faster.

Hope this helps!


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=114956