PDA

View Full Version : Garbage data is copying to other sheets column?



bunty
02-22-2012, 04:30 AM
Hi,
I am trying to copy data from one sheet to other sheet. For some column its working fine but when I am trying to copy date column its giving garbage value.

One more issue is every time when I am running the macro data is copying to next row of sheet2.But I want to overwrite the sheet2 data.It will start copy from 2nd row.

Please find the attachment and do the needful.

Thanks,

farrukh
02-22-2012, 06:53 AM
Bunty,

These are not garbage values click on the value which is like
40494.2465


Right click format cell and select date format...

Please Clear the senario what you want to copy and how ?

Cheers
farrukh

farrukh
02-22-2012, 07:11 AM
Why not some thing like that your code which is in attached file?


Sub CopyPaste()
With Sheets("Sheet1")
.Range("A1:A65536").Copy
End With
Sheets("Sheet2").[A1:A65536].PasteSpecial Paste:=xlValues
With Sheets("Sheet1")
.Range("b1:b65536").Copy
End With
Sheets("Sheet2").[b1:b65536].PasteSpecial Paste:=xlValues
on error resume next
Sheets("Sheet2").select
Columns("B:B").Select
Application.CutCopyMode = False
Selection.NumberFormat = "m/d/yyyy"
End Sub



Cheers
farrukh

bunty
02-22-2012, 12:38 PM
Hi Farrukh,

It's working fine.Is it possible to filter the data (using filter option from the menu) and copy only filtered data to other excel file?

Thanks...

farrukh
02-22-2012, 10:20 PM
Hi Bunty,

Please record a macro that wil based on your string values it will solve your issue and for copy purpose you can use the same code which is on below post.


Cheers
farrukh