ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Row Based on cell value (https://www.excelbanter.com/excel-programming/296442-hide-row-based-cell-value.html)

GaryF

Hide Row Based on cell value
 
What may I do to automatically hide all rows whos first
cell has the value "NA"?
Thank you,
gary

Bob Phillips[_6_]

Hide Row Based on cell value
 
Hi Gary,

Here is one way

Sub CopyMe()
Dim sToFind As String
Dim clastrow As Long
Dim myRange As Range

With ActiveSheet
clastrow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1").EntireRow.Insert
sToFind = "NA"
.Columns("A:A").AutoFilter Field:=1, Criteria1:=sToFind
Set myRange = .Rows("2:" & clastrow +
1).SpecialCells(xlCellTypeVisible).Rows
.Range("A1").EntireRow.Delete
End With
myRange.Hidden = True

End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"GaryF" wrote in message
...
What may I do to automatically hide all rows whos first
cell has the value "NA"?
Thank you,
gary




Gary Fuller

Hide Row Based on cell value
 
Thank you Bob.
Gary

-----Original Message-----
Hi Gary,

Here is one way

Sub CopyMe()
Dim sToFind As String
Dim clastrow As Long
Dim myRange As Range

With ActiveSheet
clastrow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1").EntireRow.Insert
sToFind = "NA"
.Columns("A:A").AutoFilter Field:=1,

Criteria1:=sToFind
Set myRange = .Rows("2:" & clastrow +
1).SpecialCells(xlCellTypeVisible).Rows
.Range("A1").EntireRow.Delete
End With
myRange.Hidden = True

End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"GaryF" wrote in

message
...
What may I do to automatically hide all rows whos first
cell has the value "NA"?
Thank you,
gary



.


Bob Phillips[_6_]

Hide Row Based on cell value
 
A pleasure Gary.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gary Fuller" wrote in message
...
Thank you Bob.
Gary

-----Original Message-----
Hi Gary,

Here is one way

Sub CopyMe()
Dim sToFind As String
Dim clastrow As Long
Dim myRange As Range

With ActiveSheet
clastrow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1").EntireRow.Insert
sToFind = "NA"
.Columns("A:A").AutoFilter Field:=1,

Criteria1:=sToFind
Set myRange = .Rows("2:" & clastrow +
1).SpecialCells(xlCellTypeVisible).Rows
.Range("A1").EntireRow.Delete
End With
myRange.Hidden = True

End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"GaryF" wrote in

message
...
What may I do to automatically hide all rows whos first
cell has the value "NA"?
Thank you,
gary



.





All times are GMT +1. The time now is 04:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com