Reputation: 25
I have 17 columns in my sheet 1 and when I am copying the data in sheet 2 only 13 columns are being pasted with the specified format sheet 2.
In that 17 columns I have date and time stamp. dates below 13 columns are pasted with yyyy-mm-dd hh:mm:ss format and dates which is beyond 13th column are pasted in (if this is the date 2018-03-01 03:00:00) it is pasted as 43160.125.
and the code I have used is
sht1.Cells.Copy
sht2.Range("A1").PasteSpecial xlPasteValues
P.S: I have used NumberFormat too but it's no use.
Upvotes: 1
Views: 338
Reputation: 149277
Try this (Untested)
sht1.Cells.Copy
sht2.Range("A1").PasteSpecial xlPasteFormats
sht2.Range("A1").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Upvotes: 1