Brown Auto
Posted in Uncategorized on 01/31/2010 05:33 pm by admin

Is it possible to hide a row(s) based on text in a single column and then auto refresh the hide every 20 secon?
My example
Column G has six possible values (Red, Blue, Green, Silver, Black, Brown)
I would like to hide every row where column G = ‘Red, Green, Silver, Black or Brown’. The only rows displayed would have the word ‘Blue’.
After 20 seconds elapses, the spreadsheet would refresh and any new rows that contain the words ‘Red, Green, Silver, Black or Brown’ would also become hidden.
Thanks in advance!
Here is one way to do this using two Excel Macros.
Open your workbook
Copy both macros below to the clipboard:
Sub Keep_Blues()
Dim i, LastRow
LastRow = Range(“G” & Rows.Count).End(xlUp).Row
For i = LastRow To 1 Step -1
If UCase(Cells(i, “G”).Value) <> “BLUE” Then
Cells(i, “G”).EntireRow.Hidden = True
End If
Next
Rerun_Keep_Blues
End Sub
Sub Rerun_Keep_Blues()
Application.OnTime Now + _
TimeValue(“00:00:20″), “Keep_Blues”
End Sub
Next, press ALT + F11
INSERT > Module
Paste both macros into the module editing area to the right.
Double click on This Workbook in the Microsoft Excel Objects in the upper left quadrant.
Change the ‘General’ dropdown menu to ‘Workbook’
Paste the following line between Private Sub Workbook_Open and End Sub:
Keep_Blues
Close back to Excel.
Save the workbook.
Reopen the workbook and the macros will be triggered to hide all rows where column G does not display ‘blue’ or ‘BLUE’ or ‘BlUe’.
Every 20 seconds thereafter the macro will be called again as long as the workbook is open.
Auto-Tune the News #10: Turtles.