How do I modify this line in VBA to only select the columns that have values?
Set rng = Range("A1", Range("A65536").End(xlUp)).SpecialCells(xlCellTypeVisible)
I don’t think I’m doing something right since the CountLarge property is several billion cells
Here is a sample of my data

For this neither you need
.SpecialCellsnor do you need to loop through the rows 🙂Here is a sample code. This will copy all the rows which have data to Sheet2 (TRIED AND TESTED)
SNAPSHOT
I am assuming that all cells in a particular row will have data and there won’t be a case like this
If there is then we will have to set the autofilter criteria accordingly.
Edit:
WAY 2
The other way would be to sort your data, pushing the blanks way down and then copying the resulting range 🙂
HTH