View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Awoll Awoll is offline
external usenet poster
 
Posts: 4
Default Creating a Hide Macro

That worked Nichevo thanks for the input,

Now i've been working on my other hide button for hours now and still can't
get it to work. now I'm trying to hide any thing that does not equal 0 in
the cells. How would I go about doing that?

Thanks for any more help.


"Nichevo" wrote in message
...
Yes is perfectly possible you could use something like this
Sub HideRows
Dim Searchtxt As String
Dim ws As Worksheet
Searchtxt = "case"
Set ws = ThisWorkbook.Worksheets("Name of Worksheet")
For row = 2 to 100
If ws.Cells(row, 4) < Searchtxt And ws.Cells(row, 4) < "" Then

'Column D is numbered 4
ws.Rows(Row).EntireRow.Hidden = True
End If
Next row
End Sub

and it undo it just do:

Sub UnHideRows
Dim Searchtxt As String
Dim ws As Worksheet
Searchtxt = "case"
Set ws = ThisWorkbook.Worksheet("Name of Worksheet")
For row = 2 to 100
ws.Rows(Row).EntireRow.Hidden = false
Next row
End Sub

problem with this is that it looks for an exact match so if its a capital

Case it will be false through this is easy to get around using something
like the Upper function