Hiding Cells
I am new to VB and very frustrated. I am trying to hide columns that
represents date reporting periods based on whether the column and particular date is outside of a range: Private Sub CommandButton1_Click() Dim cell As Range Application.ScreenUpdating = False With ActiveSheet For Each cell In .Range("b8:bt8") If cell.Value .Range("pop_key") Then ..cell.EntireColumn.Hidden = True Next End With Application.ScreenUpdating = True End Sub I keep getting a runtime 1004 error on the "if cell.value" line. v/r PAZZ |
Hiding Cells
Is the named range "pop_key" located on the activesheet? If not, then
remove the period from in front of .Range("pop_key") -- Regards, Tom Ogilvy wrote in message oups.com... I am new to VB and very frustrated. I am trying to hide columns that represents date reporting periods based on whether the column and particular date is outside of a range: Private Sub CommandButton1_Click() Dim cell As Range Application.ScreenUpdating = False With ActiveSheet For Each cell In .Range("b8:bt8") If cell.Value .Range("pop_key") Then .cell.EntireColumn.Hidden = True Next End With Application.ScreenUpdating = True End Sub I keep getting a runtime 1004 error on the "if cell.value" line. v/r PAZZ |
All times are GMT +1. The time now is 04:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com