Hi all,
I've got macro that does some filtering for me - the problem is pulling the data from sheet1 to sheet2 removes data formatting
example :
[TABLE="width: 182"]
<colgroup><col width="71" style="width: 53pt; mso-width-source: userset; mso-width-alt: 2596;"> <col width="93" style="width: 70pt; mso-width-source: userset; mso-width-alt: 3401;"> <col width="79" style="width: 59pt; mso-width-source: userset; mso-width-alt: 2889;"> <tbody>[TR]
[TD="width: 71, bgcolor: #BDD7EE"]ETD[/TD]
[TD="width: 93, bgcolor: #BDD7EE"]Original ETA to Final Destination[/TD]
[TD="width: 79, bgcolor: #BDD7EE"]Current ETA to Final Destination
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]43364[/TD]
[TD="bgcolor: transparent, align: right"]43416[/TD]
[TD="bgcolor: transparent, align: right"]43416[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]43364[/TD]
[TD="bgcolor: transparent, align: right"]43416[/TD]
[TD="bgcolor: transparent, align: right"]43416
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]43386[/TD]
[TD="bgcolor: transparent, align: right"]43417[/TD]
[TD="bgcolor: transparent, align: right"]43415
[/TD]
[/TR]
</tbody>[/TABLE]
Any idea why?
I've got macro that does some filtering for me - the problem is pulling the data from sheet1 to sheet2 removes data formatting
example :
[TABLE="width: 182"]
<colgroup><col width="71" style="width: 53pt; mso-width-source: userset; mso-width-alt: 2596;"> <col width="93" style="width: 70pt; mso-width-source: userset; mso-width-alt: 3401;"> <col width="79" style="width: 59pt; mso-width-source: userset; mso-width-alt: 2889;"> <tbody>[TR]
[TD="width: 71, bgcolor: #BDD7EE"]ETD[/TD]
[TD="width: 93, bgcolor: #BDD7EE"]Original ETA to Final Destination[/TD]
[TD="width: 79, bgcolor: #BDD7EE"]Current ETA to Final Destination
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]43364[/TD]
[TD="bgcolor: transparent, align: right"]43416[/TD]
[TD="bgcolor: transparent, align: right"]43416[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]43364[/TD]
[TD="bgcolor: transparent, align: right"]43416[/TD]
[TD="bgcolor: transparent, align: right"]43416
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]43386[/TD]
[TD="bgcolor: transparent, align: right"]43417[/TD]
[TD="bgcolor: transparent, align: right"]43415
[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub sort()
Worksheets("Filtered").Range("A2:AZ9999").Clear
Dim shSource As Worksheet
Dim shDestination As Worksheet
Set shSource = Sheets("Control") 'Source worksheet
Set shDestination = Sheets("Filtered") 'Destination worksheet
Application.ScreenUpdating = False
'Autofilter column x for "value"
shSource.UsedRange.AutoFilter Field:=4, Criteria1:=Array("gate out", "sailing", _
"discharged", "arrived", _
"x", "y", _
"z", "aa"), _
Operator:=xlFilterValues
' Copy filtered data from columns a:z
shSource.UsedRange.Columns("A:Z").Offset(1).Copy
'Paste the filtered data to Sheet "x" column Dx
shDestination.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
'Clean up
shSource.AutoFilterMode = False
Application.Goto shDestination.Range("A1")
Application.ScreenUpdating = True
MsgBox "Completed"
End Sub
Any idea why?