Copy Paste VBA format issues

D

David Pires

Morning

Hope you can help me.

I have a data set with the current date format
01/03/2009 (formatted to general = 39873)

Then I run the following macro:

Application.CutCopyMode = False
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Workbooks.Open Filename:="\\1.xlsm"
template = "1.xlsm"
Workbooks.Open Filename:="\\2.csv"
data = "2.csv"
sheet = "sheet1"
Workbooks(data).Worksheets(sheet).Cells.Copy
Workbooks(template).Worksheets("work").Range("a1").PasteSpecial Paste:=xlValues
Workbooks(data).Close

The problem is that when it pastes the data the date changes format to US on my pivot tables, very strange since when I do it manually the data format is maintained.
Anyone know what this can be?
Thank you in advance
 

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