View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.setup
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default VBA determine computer region

Why pull your hair out??

Sub date_in()
Dim d As Date
Dim s As String
s = InputBox("Enter date: ", "18 January 2007")
d = DateValue(s)
MsgBox (d)
End Sub

Using a universal format means never have to guess if its Dec first or Jan
twelveth
--
Gary''s Student - gsnu200724


"Viperv10" wrote:

I have a macro for an Excel spreadsheet that I used to add dates.
Unfortunately I wrote it on a computer that was in the Canada region
DD/MM/YYYY and when I moved it to a computer in US region MM/DD/YYYY it broke
as it was adding on days.

How can I use VBA to determine wether the date format is in MM/DD/YYY or
DD/MM/YYYY the reason I need this I am inputing the day as a string (it has
to be this way) in the format of DD/MM/YYYY and I need to add 1 day to it.

Thanks.