select only used rows and only visible cells


Rokuro kubi

I've used the following macro by Frank Kabel to select only usedrows
but as I'm dealing with subtotals (level 2 so only the subtotals
themselves are visible) I only want to copy the visible rows. How do I
go about doing that?

Before the Copy command I've specified -
Selection.SpecialCells(xlCellTypeVisible).Select - but it still copies
all the used rows not the visible cells only

"Sub copy_used()
Dim source As Worksheet
Set source = Worksheets("Sheet2")
source.Paste Destination:=source.Range("A1")
End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question