This question already has an answer here:
- Excel VBA - Delete empty rows 7 answers
I have a spreadsheet that populates rows based on data from a pivot table (imported through ODBC). I'm using VLOOKUP, for example:
=VLOOKUP(A8;Data!B1:I298;2;FALSE)
The result is something like
Name1
Name2
Address1
Address2
Postalcode
Country
It might happen that some of the pivot columns are empty, resulting in
Name1
0
Address1
0
Postalcode
0
What I need is some sort of function that loops through a range of rows, for example A8 - A14 and delete the rows that are "empty". My problem is that the rows are not truly empty, they still return 0 and contain the VLOOKUP formula.
Is this achievable somehow? I hope I'm making sense.
Thanks.
Example
with the code
deletes 0s so the result
achieve the same result using autofilter which is normally a bit faster than looping
code
result