Hi Mark,
Am Mon, 27 Jan 2020 18:38:53 -0800 (PST) schrieb
noodnutt@gmail.com:
I am trying to copy all of the used range of a table and PasteSpecial the values only.
This includes the Header as I will be rearranging the columns and manipulating the data.
try:
Sub CopyValues()
Dim myRow As Long, LRow As Long
Dim sWS As Worksheet, tWS As Worksheet
Dim dest As Range
Set sWS = Sheets("Import 1")
Set tWS = Sheets("Import 2")
myRow = tWS.Cells(Rows.Count, "A").End(xlUp).Row
Set dest = IIf(myRow = 1, tWS.Cells(1, 1), tWS.Cells(myRow + 1, 1))
With sWS
LRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.ListObjects(1).Range.AutoFilter Field:=6, Criteria1:="<>"
If myRow = 1 Then
.Range("A1:AZ" & LRow).Copy
dest.PasteSpecial xlPasteValues
Else
.Range("A2:AZ" & LRow).Copy
dest.PasteSpecial xlPasteValues
End If
.AutoFilterMode = False
End With
End Sub
Regards
Claus B.
--
Windows10
Office 2016
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)