I have a very long macro that I've written that looks at a report sheet, breaks it down by many different criteria (putting some of the results on different sheets), and does hundreds of calculations. Everything was looking good until I noticed that when the result was one line, it wasn't calculating properly. I traced it back to this block. (The top two lines are workarounds to the .showalldata method not working properly.)
Worksheets("900").ListObjects("NF900T").ShowAutoFilter = False
Worksheets("900").ListObjects("NF900T").ShowAutoFilter = True
sh900.Range("A1").CurrentRegion.AdvancedFilter xlFilterInPlace, shNFTeen.Range("GC63").CurrentRegion
shNFSnap.Range("C109") = "=subtotal(3,NF900T[BID])"
shNFSnap.Range("E109") = "=subtotal(9,NF900T[CIRC])"
sh900.Range("A1").SpecialCells(xlCellTypeVisible).Copy
shScratch.Range("A1").PasteSpecial xlPasteValues
Everything works fine until it gets to the 6th line where it needs to copy the visible cells. (This particular block doesn't have an autofilter but some blocks do, so I had to use the visible cells property to not include any filtered results on those blocks.) When it runs this line, it only selects/copies A1 even though there are other headers and filled-in cells. It seems to work fine (select and copy everything) when there is more than one line of results.
Also, I used sh900.Range[...] but should I be referencing that table instead of the sheet and range? Or is that a six in one hand, half a dozen in the other situation and doesn't matter?
Range("A1").CurrentRegion.SpecialCells...
?sh900.Range("A1").SpecialCells(xlCellTypeVisible).Copy Destination:=sh900.Range("A2")
N.B. Both Cell address A1 & A2 are adjustable. Make it clear whether U want to copy only cell A1 or all Rows been filtered!!