View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default changing find to for/next

ceemo,

Try the macro below. Note that as written, it is case insensitive. Chang ethe False to True to
make it match case as well.

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myR As Range
Dim myC As Range
Dim myA As String

Set myR = Range("1:1")

Set myC = myR.Find(What:="t", LookAt:=xlWhole, MatchCase:=False)
myA = myC.Address

While Not myC Is Nothing
myC.EntireColumn.Hidden = True
Set myC = myR.FindNext(myC)
If myC.Address = myA Then GoTo FoundAll
Wend

FoundAll:

End Sub

"ceemo" wrote in message
...

the original code hides those rows where there is a y in column a. What
id like to do is hide those columns where there is a t in row 1
(oppisite if you like)


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=545451