I've just started learning VBA and I've been stuck on a problem for a while and hope someone can help.
What I want to do is to first loop through each row in a dynamic range that I copied from another sheet starting at column 8 out of 58 columns and check if the value in each cell in the row is either "0" or another value.
If the value is "0", then I want it to go to the next row and check to see if that value is also zero. Continue this until the very last row if all cell values are 0 or go to the next column if there is a cell value other than 0.
If all the cells in the column are 0, I want to delete the column before going to the next column. Repeat this process for all the columns in the range.
The end result would be that all the columns in the initial range with only 0 values will be deleted while columns with values will remain.
Can someone please help?
Below is the code I have so far:
Dim CopyRange as Range
Dim iRow as Range
Set CopyRange = Range("H2", Range("H2").End(xldown))
For each iRow in CopyRange
if iRow = "0" then
activecell.offset(1,0).select
else
end if
next iRow
*delete column *go to next column and repeat for remaining columns