A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
You could use something like this:
Sub CopyVisibleRanges()
Dim CopyRange As Range
On Error Resume Next
Set CopyRange = Application.InputBox(Prompt:="Select cells to copy", Title:="Copy from", Type:=8)
If Not CopyRange Is Nothing Then
Set CopyRange = CopyRange.SpecialCells(xlCellTypeVisible)
Dim pasteRange As Range
Set pasteRange = Application.InputBox(Prompt:="Select first cell for pasting", Title:="Paste To", Type:=8)
On Error GoTo whoops
If Not pasteRange Is Nothing Then
Application.ScreenUpdating = False
Dim colOffset As Long
colOffset = pasteRange.Column - CopyRange.Column
Dim area As Range
For Each area In CopyRange.Areas
With area
.offset(, colOffset).Value = .Value
End With
Next area
End If
End If
clean_up:
Application.ScreenUpdating = True
Exit Sub
whoops:
MsgBox "Error: " & err.Number & vbLf & err.Description
Resume clean_up
End Sub
Note this has to do the copying too.