Question : Excel VBA date format, incorrect regional options

I have a little VBA macro which imports some data from another Excel sheet.

One of the fields in the source sheet is the date, in the format dd.mm.yyyy.

This needs converting to dd/mm/yyyy.

I have tried a simple find/replace on the date column to change the period into a slash. This works fine manually, but when done via VBA it transforms the date into mm/dd/yyyy format.

1:
2:
3:
4:
    
Sheets("Sheet1").Range("E1").Select
Sheets("Sheet2").Range("J2").Copy Destination:=ActiveCell
ActiveCell.Replace What:=".", Replacement:="/"


After 'ActiveCell.Replace What:=".", Replacement:="/"', the cell changes from "02.07.2010" to "07/02/2010"

I've tried setting the cell format to dd/mm/yyyy both before and after the Replace line.

My regional options are all set to UK dd/mm/yyyy format.

I'm now stuck!

Answer : Excel VBA date format, incorrect regional options

In 2008 server you have the new group policy options to play with.  Look under - User config -Preferences - Control Panel Settings - Internet Settings. RIght click new (choose ie version) then enter your homepage(s) in. Hit the last tab - common - tick item-level targeting and press the targeting button.

From here you can define what this policy applies to e.g.

New Item - security group - select domain users -ok

then to exclude individuals

New Item - user - select user account then hit - item options and change to 'is not'

Your xp and vista clients will need the group policy client side update installed

http://support.microsoft.com/kb/943729
Random Solutions  
 
programming4us programming4us