View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
davegb davegb is offline
external usenet poster
 
Posts: 573
Default Combo column identifier

I've been modifying the code Doug gave me to hide the columns in every
worksheet in the workbook. But I'm getting an error, "Object variable
or with block variable not set" when I run the following:

Sub AllSheetsColHide()
'for all sheets in currently active workbook, assigned to button

Dim TopCell As Range
Dim TopCol As Range
Dim Cols2Hide As Range
Dim wkSht As Object

For Each wkSht In ActiveWorkbook.Worksheets

Set TopCell = Rows(3).Find(What:="top", LookIn:=xlValues)
Set TopCol = Columns(TopCell.Column)
<------------------------[error here]
Set Cols2Hide = Range(TopCol, Columns("AC"))
Cols2Hide.Hidden = True

Next wkSht

End Sub

Any suggestions? Thanks in advance!