formating inputbox result in excel

N

NoelH

Hi, I have use the inputbox method to seek from the user a date. When the
date 1st Feb 2006 (1/02/2006) is placed into the sheet it shows in the
mm/dd/yy format. I have tried formatting the cell to dd/mm/yy. I know that
there is a way and it has (i think) to do with a special paste function to
allow all dates entered in the inputbox to be in the Australian format
(dd/mm/yy) context. Many thanks in adavance for any help.
 
K

Ken Johnson

Hi NoelH,
try this...

Public Sub CorrectDate()
Dim strDate As String
strDate = Application.InputBox("What Date?", 2)
Cells(1, 1) = CDate(strDate)
End Sub

ie, the CDate conversion seems to do the trick.

Fellow Aussie Ken Johnson
 
Top