请帮助我处理此代码。我要复制的是数据并将其粘贴到单元格中并保持隐藏状态。但是在使用我的代码并将其粘贴之后,仍然可见。如何制作 vba代码,使其在粘贴后会隐藏单元格?请帮我。谢谢。
Sub selectVisibleRange()
Dim DbExtract, DuplicateRecords As Worksheet
Set DbExtract = ThisWorkbook.Sheets("Sheet2")
Set DuplicateRecords = ThisWorkbook.Sheets("Sheet1")
DbExtract.Range("X:X").SpecialCells(xlCellTypeVisible).Copy
DuplicateRecords.Cells(1, 3).PasteSpecial Paste:=8
End Sub
答案 0 :(得分:0)
我现在知道我问题的答案。
Private Sub CommandButton1_Click()
Dim DbExtract, DuplicateRecords As Worksheet
Set DbExtract = ThisWorkbook.Sheets("Sheet2")
Set DuplicateRecords = ThisWorkbook.Sheets("Sheet1")
DbExtract.Range("E:E").SpecialCells(xlCellTypeVisible).Copy
DuplicateRecords.Cells(1, 1).PasteSpecial
DuplicateRecords.Cells(1, 1).EntireColumn.Hidden = True
End Sub