【发布时间】:2019-05-30 08:59:52
【问题描述】:
我有下面的工作代码,当我从一列中选择数据时,它会将过滤后的数据复制到过滤后的单元格中。
当我尝试一系列多列时,它会将数据复制回单列并粘贴如下:column1V1、column1V2、column1V3 等
如何将过滤后的数据以相同的顺序/格式粘贴到其他列中?
Sub Filtered_Cells()
Dim from As Range
Set from = Application.InputBox("Select range to copy selected cells to", Type:=8)
from.Select
Selection.SpecialCells(xlCellTypeVisible).Select
Call Copy_Filtered_Cells
End Sub
Sub Copy_Filtered_Cells()
Set from = Selection
Set too = Application.InputBox("Select range to copy selected cells to", 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
【问题讨论】:
-
你能突出显示哪一行显示错误吗?
-
嗨!不涉及任何错误。它工作正常。我想扩展它的功能,以便它可以从多个列复制多个数据并以相同的格式/顺序将其粘贴到其他列