View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
davegb davegb is offline
external usenet poster
 
Posts: 573
Default hide columns from find

Thanks again, Tom (sorry I called you "Steve" in last reply). Works
fine, as usual!

Tom Ogilvy wrote:
Sub HideCol()
Dim rTopCell As Range
Dim lColTop As Long
Dim WkSht As Worksheet
For Each WkSht In ActiveWorkbook.Worksheets
If Not Right(WkSht.Name, 7) = "Records" Then

Set rTopCell = WkSht.Range("3:3").find("top", _
LookIn:=xlValues, LookAt:=xlPart)
If Not rTopCell Is Nothing Then
lColTop = rTopCell.Column

WkSht.Range( WkSht.Columns(lColTop), _
WkSht.Columns("AC")).Hidden =True
End If
End If
Next
End Sub


--
Regards,
Tom Ogilvy

"davegb" wrote in message
oups.com...
That worked, Steve. But I can't figure out why the rest of the macro
isn't incrementing. The macro runs, but just on the currently selected
sheet.

Sub HideCol()
Dim rTopCell As Range
Dim lColTop As Long
Dim WkSht As Worksheet
For Each WkSht In ActiveWorkbook.Worksheets
If Not Right(WkSht.Name, 7) = "Records" Then

Set rTopCell = ActiveSheet.Range("3:3").find("top",
LookIn:=xlValues, LookAt:=xlPart)
If Not rTopCell Is Nothing Then
lColTop = rTopCell.Column

WkSht.Range(Columns(lColTop), Columns("AC")).Hidden =
True
End If
End If
Next
End Sub

STEVE BELL wrote:
Worksheet("MySheet").Range(Columns(col), Columns(26)).Hidden = True

where col = rFoundCell.column
--
steveB

Remove "AYN" from email to respond
"davegb" wrote in message
oups.com...
How do you tell XL to hide all columns in the active worksheet from a
cell where you found text, rFoundCell (declared as a range) to column
"Z"?