[英]How to select and paste values in filtered cells in Excel using VBA
請參見下圖,其中在a列中應用了過濾器以選擇項目“ b”,然后在注釋字段中更新了“確定”。 您是否知道如何通過宏完成此操作? 另外,我需要知道在打開並過濾過濾器后如何選擇列中的可見單元格。
Sub Copy_Filtered_Cells()
Set from = Application.InputBox("Select range of Cell to copy", Type:=8).SpecialCells(xlCellTypeVisible)
'Selection.SpecialCells(xlCellTypeVisible).Select
'Set from = Selection
Set too = Application.InputBox("Select range to Paste Copied Cells", Type:=8)
For Each Cell In from
Cell.Copy
For Each thing In too
If thing.EntireRow.RowHeight > 0 Then
thing.PasteSpecial
Set too = thing.Offset(1).Resize(too.Rows.Count)
Exit For
End If
Next
Next
End Sub
它可能為您工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.