下面是我的代碼如下。如何複製粘貼來自過濾範圍的特定單元格
Sub AddExistingItemToRWP()
Dim AddRow As Integer
Dim eLastRow As Integer
AddRow = Worksheets("Recipe Workarea-Product").Range("A" & Rows.Count).End(xlUp).Row
eLastRow = Worksheets("Additional Existing Raw Mat.").Range("A" & Rows.Count).End(xlUp).Row
Dim Rng As Range
Sheets("Additional Existing Raw Mat.").Select
Set Rng = ActiveSheet.AutoFilter.Range
With Sheet12
With .Range("$A$1:K" & eLastRow)
.AutoFilter Field:=11, Criteria1:=("Y")
.SpecialCells (xlCellTypeVisible)
.Offset(1, 0) _
.Copy Destination:=Sheet8.Range("H" & AddRow + 1)
.PasteSpecial Paste = xlPasteValues
End With
End With
AutoFillCols (AddRow)
Sheets("Additional Existing Raw Mat.").Select
End Sub
.pastespecial單元格似乎不工作。這是什麼正確的語法?
它的工作原理,但它會返回一個錯誤,因爲「粘貼」爲空。我如何忽略這個錯誤? –