Trying to code in a loop...

It needs to loop across columns on row 11, when it hits a blank/empty cell, it loops down that column....eg Hits a blank cell, goes down and hits another blank cell, goes down again etc until it gets to a pre-defined range of rows (Lets just make it easy and say 100 rows).

If every cell within that column is blank, the macro hides that column.

I then need the macro to carry on until it hits the end column.

Columns start from 2 (B) and go across to 22 (W).


I currently have the below...which does not work and i'm not sure why.

Any help would be greatly appreciated.


    Dim beg_row As Long
    Dim i       As Long
    
    beg_row = 11
    
    For i = 2 To 23
        
        If Cells(beg_row, i).Value = "" Then
            
            Cells(beg_row, i) = "test"
            Columns(i).Hidden = Columns(i).Find("*", , xlValues, , 1, 2).Row = beg_row
            
        End If
        
    Next i