Skip to content

Instantly share code, notes, and snippets.

@phongaster
Created October 16, 2019 08:57
Show Gist options
  • Save phongaster/91ce921d34eb9308ef9f6e71021bfe1c to your computer and use it in GitHub Desktop.
Save phongaster/91ce921d34eb9308ef9f6e71021bfe1c to your computer and use it in GitHub Desktop.
Pasting into visible cells only
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment