I have a sheet with somewhere in a1:a100 there is text "company". I would like to hide all rows up to and including that row
I have a sheet with somewhere in a1:a100 there is text "company". I would like to hide all rows up to and including that row
Question..."up to and including" - do you mean row 1 through the row with "company" or do you mean row 100 up to the row including "company"?
I guess basically, do you want the rows above or below the row with "Company" left showing?
Company and above (which can be found somewhere a1:100)
e.g. if "company" is on row 30 than I want to hide rows 1 through (and including) 30
My first try at vba... but this it what I was trying:
But this doesn't work as I'm doing something wrong![]()
Sub Hiderows() Dim lastRow As Integer Set lastRow = Cells.Find(What:="Company:", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False) Rows("A1" & ":" & lastRow).EntireRow.Hidden = True End Sub
Last edited by itcheg; 05-28-2009 at 06:39 PM.
itcheg,
Please edit your post to add code tags.
Entia non sunt multiplicanda sine necessitate
I worked it out, figured I would share it.
![]()
Sub Hiderows() Set lastRow = Cells.Find(What:="Company:", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=True, SearchFormat:=False) Rows("1:" & lastRow.Row).EntireRow.Hidden = True End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks