formating inputbox result in excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top