程序要求
在表格筛选的状态下,对选中的单元格区域进行复制粘贴为数值
可实现的代码(宏)
Sub CopyValuesOnly()
Dim rng As Range, cell As Range
Set rng = Selection
If rng.Cells.Count = 1 Then
rng.Value = rng.Value
Else
Set rng = Selection.SpecialCells(xlCellTypeVisible)
For Each cell In rng.Cells
If Not cell.EntireRow.Hidden And Not cell.EntireColumn.Hidden Then
cell.Value = cell.Value
End If
Next cell
End If
End Sub