Hiding Cells

Z

Zeitlin

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
 
T

Tom Ogilvy

Is the named range "pop_key" located on the activesheet? If not, then
remove the period from in front of
.Range("pop_key")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top