Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am still trying to learn the in's and out's of macros. I need help.
I have a spreadsheet with a range from A1:a3200. I have started a macro to find some text in the H column. This macro keeps deleting the headers in the first 2 rows. Also, I need to find a way to hide rows that have the number 1 in columns X, AC, AH, AM and AR. Here is what I have so far. Sub P690_Qtr1_Macro() Dim rngCell As Range Application.ScreenUpdating = False With ActiveSheet Intersect(.UsedRange, _ Columns("H")).EntireRow.Hidden = False For Each rngCell In Intersect(.UsedRange, _ Columns("H")) If rngCell = ("AIX") = False And _ rngCell = ("AIX - P690") = False And _ rngCell = ("AIX - P660") = False And _ rngCell = ("AIX - P630") = False Then _ rngCell.EntireRow.Hidden = True Next rngCell End With Application.ScreenUpdating = True End Sub I haven't been successful at getting past this point. Any help that you can give is GREATLY appreciated. Denise Reaves New Member |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did you mean that x, ac, ah, am, and ar all had to be 1's or any of them could
be a 1 (to hide the row)? I guessed any of them: Option Explicit Sub P690_Qtr1_Macro() 'X, AC, AH, AM and AR Dim rngCell As Range Application.ScreenUpdating = False With ActiveSheet Intersect(.UsedRange, .Columns("H")).EntireRow.Hidden = False For Each rngCell In Intersect(.UsedRange, .Rows("3:65536"), Columns("H")) If (rngCell < "AIX" _ And rngCell < "AIX - P690" _ And rngCell < "AIX - P660" _ And rngCell < "AIX - P630") _ Or (.Cells(rngCell.Row, "x") = 1 _ And .Cells(rngCell.Row, "AC") = 1 _ And .Cells(rngCell.Row, "AH") = 1 _ And .Cells(rngCell.Row, "AM") = 1 _ And .Cells(rngCell.Row, "AR") = 1) Then rngCell.EntireRow.Hidden = True End If Next rngCell End With Application.ScreenUpdating = True End Sub Denise Reaves wrote: I am still trying to learn the in's and out's of macros. I need help. I have a spreadsheet with a range from A1:a3200. I have started a macro to find some text in the H column. This macro keeps deleting the headers in the first 2 rows. Also, I need to find a way to hide rows that have the number 1 in columns X, AC, AH, AM and AR. Here is what I have so far. Sub P690_Qtr1_Macro() Dim rngCell As Range Application.ScreenUpdating = False With ActiveSheet Intersect(.UsedRange, _ Columns("H")).EntireRow.Hidden = False For Each rngCell In Intersect(.UsedRange, _ Columns("H")) If rngCell = ("AIX") = False And _ rngCell = ("AIX - P690") = False And _ rngCell = ("AIX - P660") = False And _ rngCell = ("AIX - P630") = False Then _ rngCell.EntireRow.Hidden = True Next rngCell End With Application.ScreenUpdating = True End Sub I haven't been successful at getting past this point. Any help that you can give is GREATLY appreciated. Denise Reaves New Member -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem creating named ranges in a Macro! | Excel Discussion (Misc queries) | |||
Problem with creating pivottable | Excel Discussion (Misc queries) | |||
Macro creating chart gallery giving problem | Charts and Charting in Excel | |||
Creating Names Baffling Problem | Excel Discussion (Misc queries) | |||
Problem with creating a Word Document | Excel Programming |