0

I am trying to copy a autofiltered range to a new sheet. The number of autofiltered rows is inserted into the new sheet at a certain point and then the copied range is copied and pasted over in the new inserted rows. I've got everything I need, but my usual methods of pasting aren't working.

rwno is the rwno for the find using the set found function

rwncnt is the number visible rows

rng.select
selection.autofilter field:=col1,criteria1:=index
rwcnt = application.worksheetfunction.subtotal(3,range("A2:A" * lrbom2))
rng.specialcells(xlcelltypevisible).select
selection.copy
newbom.activate
newbom.range("A" & rwno + 1 & ":A" & rwno + rwcnt).entirerow.insert
cells(rwno+1,1).select/Range("A" & rwno +1).select
activesheet.paste
Jeff
  • 43
  • 1
  • 6
  • You are only qualifying the worksheet for some of the ranges and this usually leads to issues (e.g. `cells(rwno+1,1)` => `newbom.Cells(rwno+1,1)`. Also try and avoid using select and activate: https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba – Tragamor Sep 30 '21 at 16:33

0 Answers0