Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() I have a table with various rows, identified, lets say, by the type of info (Requirements / Guidelines / Info). I want to program a macro (for a button) to hide all rows that contains "Info" in the "type" column. I do not want to enter the number of the row in the macro, because if a row is inserted, the program has to be revised. I would also need a macro to automatically unhide all rows. Thanx a lot! -- Turquoise_dax ------------------------------------------------------------------------ Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185 View this thread: http://www.excelforum.com/showthread...hreadid=553626 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
One way wothout having to use a macro would be to do Data Filter
AutoFilter and on column "type" choose Custom Does NOT contain Info This will then show only those rows that do not contain "info" in the "type" column. To reverse the situation back to normal, just do Data Filter AutoFilter again......it toggles back. hth Vaya con Dios, Chuck, CABGx3 "Turquoise_dax" wrote: I have a table with various rows, identified, lets say, by the type of info (Requirements / Guidelines / Info). I want to program a macro (for a button) to hide all rows that contains "Info" in the "type" column. I do not want to enter the number of the row in the macro, because if a row is inserted, the program has to be revised. I would also need a macro to automatically unhide all rows. Thanx a lot! -- Turquoise_dax ------------------------------------------------------------------------ Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185 View this thread: http://www.excelforum.com/showthread...hreadid=553626 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() I need to use a macro, because it is to be linked to a button. I tried this code: ActiveSheet.Columns("B").Select Selection.AutoFilter Field:=1, Criteria1:="info" Selection.EntireRow.Hidden = True but ALL rows get hidden. What is wrong? -- Turquoise_dax ------------------------------------------------------------------------ Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185 View this thread: http://www.excelforum.com/showthread...hreadid=553626 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() I need to use a macro, because it is to be linked to a button. I tried this code: ActiveSheet.Columns("B").Select Selection.AutoFilter Field:=1, Criteria1:="info" Selection.EntireRow.Hidden = True but ALL rows get hidden. What is wrong? -- Turquoise_dax ------------------------------------------------------------------------ Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185 View this thread: http://www.excelforum.com/showthread...hreadid=553626 |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try this one, it's a toggle on/off
Sub HideInfoRows() Range("A2").Select If ActiveSheet.AutoFilterMode = False Then Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="<*info*", Operator:=xlAnd Else Selection.AutoFilter End If End Sub hth Vaya con Dios, Chuck, CABGx3 "Turquoise_dax" wrote: I need to use a macro, because it is to be linked to a button. I tried this code: ActiveSheet.Columns("B").Select Selection.AutoFilter Field:=1, Criteria1:="info" Selection.EntireRow.Hidden = True but ALL rows get hidden. What is wrong? -- Turquoise_dax ------------------------------------------------------------------------ Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185 View this thread: http://www.excelforum.com/showthread...hreadid=553626 |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() The following will enable you to limit your macro loop to only the active range, without having to always edit for any inserted rows. Option Explicit '-------------- Private Function FindLastCell() Dim lCell As String Range("A1").Select lCell = ActiveCell.SpecialCells(xlLastCell).Address FindLastCell = lCell End Function '-------------- Assuming you are looking for the word "Info" in column B (2) '-------------- Sub HideRows() Dim dSearch As String, lRow As Long, rNum As Long Application.ScreenUpdating = False Cells.EntireRow.Hidden = False dSearch = "Info" lRow = FindLastRow() For rNum = 1 To lRow If Cells(rNum, 2).Value = dSearch Then 'Column B is Col 2 Rows(rNum).EntireRow.Hidden = True End If Next Application.ScreenUpdating = True End Sub '-------------- -- DCSwearingen Getting old, but love computers. ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=553626 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
resetting last cell | Excel Discussion (Misc queries) | |||
Removing Rows for Printing | Excel Worksheet Functions | |||
Three tables on one worksheet, need to hide rows | Excel Discussion (Misc queries) | |||
Macro to delete rows with same data | Excel Worksheet Functions | |||
macro to hide rows if cell is blank | Excel Worksheet Functions |