Hello all,

I need to hide columns according to a value (zero).

I have to check the value 2 rows above the blank one at column A
Then check value = 0 in a range of columns within P and BP (Witch is 16 and 68)
If value = 0 then hide column.

I have this code, and don't know why it isn't working..
Sub hide_columns()
'Esconder colunas quando as quantidades são iguais a zero.
Dim Column As Integer

'Escolher da Coluna P (16ª) ao BP (68ª)
For Column = 16 To 68

'Escolhe a linha das Quantidades Totais
Worksheets("ENVELOPES").Range("A6").End(xlDown).Select
ActiveCell.Offset(2, 0).Select
    
'Verifica se as quantidades são zero
    If Cells(ActiveCell.Row, tabela1).Value = 0 Then
 Sheets("ENVELOPES").Cells(ActiveCell.Row, Column).EntireColumn.Hidden = True

End If
Next Column
End Sub
Thanks in advance for your help