inputbox uk date


G

Guest

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
 
Ad

Advertisements

G

Guest

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


„tina†ezt írta:
 
B

Bob Phillips

Make sure that you declare MyDate as a Date variable.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
G

Guest

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
 
Ad

Advertisements

B

Bob Phillips

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 Tools>Options;
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)
 

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

Top