ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inputbox uk date (https://www.excelbanter.com/excel-programming/357958-inputbox-uk-date.html)

tina

inputbox uk date
 
Hi
I have a macro which request a date which is then used in an advanced filter
My problem is the date seems to be american format mm/dd/yy but i need uk
the cell g2 is formatted to dd/mm/yy but comes out as mm/dd/yy after
inputbox used
MYDATE = InputBox("ENTER DATE DD/MM/YY")
Range("G1") = "<="
Range("G2") = MYDATE
how do I format inputbox?
thanks Tina

Stefi

inputbox uk date
 
I'm afraid you have to change your Windows/Regional Settings/Language from
English US to English UK.
Regards,
Stefi


€˛tina€¯ ezt Ć*rta:

Hi
I have a macro which request a date which is then used in an advanced filter
My problem is the date seems to be american format mm/dd/yy but i need uk
the cell g2 is formatted to dd/mm/yy but comes out as mm/dd/yy after
inputbox used
MYDATE = InputBox("ENTER DATE DD/MM/YY")
Range("G1") = "<="
Range("G2") = MYDATE
how do I format inputbox?
thanks Tina


Bob Phillips[_6_]

inputbox uk date
 
Make sure that you declare MyDate as a Date variable.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"tina" wrote in message
...
Hi
I have a macro which request a date which is then used in an advanced

filter
My problem is the date seems to be american format mm/dd/yy but i need uk
the cell g2 is formatted to dd/mm/yy but comes out as mm/dd/yy after
inputbox used
MYDATE = InputBox("ENTER DATE DD/MM/YY")
Range("G1") = "<="
Range("G2") = MYDATE
how do I format inputbox?
thanks Tina




tina

inputbox uk date
 
Thanks Bob
I had tried lots of formatting but forgot about declaring variable I do not
decale much as macros seem to work without but obviously more important than
I thought must stop being lazy and use good practises
thanks again
Tina

"Bob Phillips" wrote:

Make sure that you declare MyDate as a Date variable.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"tina" wrote in message
...
Hi
I have a macro which request a date which is then used in an advanced

filter
My problem is the date seems to be american format mm/dd/yy but i need uk
the cell g2 is formatted to dd/mm/yy but comes out as mm/dd/yy after
inputbox used
MYDATE = InputBox("ENTER DATE DD/MM/YY")
Range("G1") = "<="
Range("G2") = MYDATE
how do I format inputbox?
thanks Tina





Bob Phillips[_6_]

inputbox uk date
 
Tina,

It is always a good practice to declare variables, and even better to add
Option Explicit at the start of a module, which will catch typos. Even
better, set it as a default in your options,

in the VBIDE goto ToolsOptions;
on the Editor tab click the Require Variable Declaration checkbox;
it will then automatically be added to all modules.


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"tina" wrote in message
...
Thanks Bob
I had tried lots of formatting but forgot about declaring variable I do

not
decale much as macros seem to work without but obviously more important

than
I thought must stop being lazy and use good practises
thanks again
Tina

"Bob Phillips" wrote:

Make sure that you declare MyDate as a Date variable.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"tina" wrote in message
...
Hi
I have a macro which request a date which is then used in an advanced

filter
My problem is the date seems to be american format mm/dd/yy but i need

uk
the cell g2 is formatted to dd/mm/yy but comes out as mm/dd/yy after
inputbox used
MYDATE = InputBox("ENTER DATE DD/MM/YY")
Range("G1") = "<="
Range("G2") = MYDATE
how do I format inputbox?
thanks Tina








All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com