Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
BKO BKO is offline
external usenet poster
 
Posts: 15
Default HIDE row if CELL value is #NA

I have a long list where I want to hide the rows when cell B(row) = #NA

I dont want to use Autofilter, is there a function or maco to hide these rows

Thank you very much in advance

--

There are only 10 types of people in the world:
Those who understand binary and those who don''t.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default HIDE row if CELL value is #NA

Try:-

Sub Hiderows()
Dim r As Long, LastRow As Long
LastRow = Range("B65536").End(xlUp).Row
For r = LastRow To 1 Step -1
If IsError(Cells(r, 2)) Then
Rows(r).EntireRow.Hidden = True
End If
Next r
End Sub

Mike

"BKO" wrote:

I have a long list where I want to hide the rows when cell B(row) = #NA

I dont want to use Autofilter, is there a function or maco to hide these rows

Thank you very much in advance

--

There are only 10 types of people in the world:
Those who understand binary and those who don''t.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
BKO BKO is offline
external usenet poster
 
Posts: 15
Default HIDE row if CELL value is #NA

Thanks very much mike, Your function works fine,

Can I start the function automatic if the sheet is selected ?

--

There are only 10 types of people in the world:
Those who understand binary and those who don''t.



"Mike H" wrote:

Try:-

Sub Hiderows()
Dim r As Long, LastRow As Long
LastRow = Range("B65536").End(xlUp).Row
For r = LastRow To 1 Step -1
If IsError(Cells(r, 2)) Then
Rows(r).EntireRow.Hidden = True
End If
Next r
End Sub

Mike

"BKO" wrote:

I have a long list where I want to hide the rows when cell B(row) = #NA

I dont want to use Autofilter, is there a function or maco to hide these rows

Thank you very much in advance

--

There are only 10 types of people in the world:
Those who understand binary and those who don''t.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default HIDE row if CELL value is #NA

From the forms toolbar put a button on the worksheet you want this to work on
and assign the code to it.

You can have a button on more than 1 sheet that calls the macro but it will
always work on the active sheet i.e. the one you were in when it was called.

Mike

"BKO" wrote:

Thanks very much mike, Your function works fine,

Can I start the function automatic if the sheet is selected ?

--

There are only 10 types of people in the world:
Those who understand binary and those who don''t.



"Mike H" wrote:

Try:-

Sub Hiderows()
Dim r As Long, LastRow As Long
LastRow = Range("B65536").End(xlUp).Row
For r = LastRow To 1 Step -1
If IsError(Cells(r, 2)) Then
Rows(r).EntireRow.Hidden = True
End If
Next r
End Sub

Mike

"BKO" wrote:

I have a long list where I want to hide the rows when cell B(row) = #NA

I dont want to use Autofilter, is there a function or maco to hide these rows

Thank you very much in advance

--

There are only 10 types of people in the world:
Those who understand binary and those who don''t.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 109
Default HIDE row if CELL value is #NA

If you want it to happen automatically whenever the sheet is activated
you should put it in the worksheet activate event.

Right click on the relevant worksheet, click on view code, and use the
sub name as below:


Private Sub Worksheet_Activate()

Dim r As Long, LastRow As Long
LastRow = Range("B65536").End(xlUp).Row
For r = LastRow To 1 Step -1
If IsError(Cells(r, 2)) Then
Rows(r).EntireRow.Hidden = True
End If
Next r

End Sub

Good luck.

Ken
Norfolk, VA




On Jun 11, 8:39 am, Mike H wrote:
From the forms toolbar put a button on the worksheet you want this to work on
and assign the code to it.

You can have a button on more than 1 sheet that calls the macro but it will
always work on the active sheet i.e. the one you were in when it was called.

Mike



"BKO" wrote:
Thanks very much mike, Your function works fine,


Can I start the function automatic if the sheet is selected ?


--


There are only 10 types of people in the world:
Those who understand binary and those who don''t.


"Mike H" wrote:


Try:-


Sub Hiderows()
Dim r As Long, LastRow As Long
LastRow = Range("B65536").End(xlUp).Row
For r = LastRow To 1 Step -1
If IsError(Cells(r, 2)) Then
Rows(r).EntireRow.Hidden = True
End If
Next r
End Sub


Mike


"BKO" wrote:


I have a long list where I want to hide the rows when cell B(row) = #NA


I dont want to use Autofilter, is there a function or maco to hide these rows


Thank you very much in advance


--


There are only 10 types of people in the world:
Those who understand binary and those who don''t.- Hide quoted text -


- Show quoted text -



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
auto-hide rows, cell format (# and @), update cell refs, shade cel Mo2 Excel Discussion (Misc queries) 0 April 17th 07 03:44 AM
Hide cell values based on a condition in another cell Cat Excel Worksheet Functions 1 January 4th 07 07:21 AM
How to hide a particular cell....... PSL Excel Discussion (Misc queries) 1 July 18th 06 01:24 PM
if cell = 0 then hide the row? Al Excel Discussion (Misc queries) 9 December 15th 05 01:32 AM
Hide Value of Cell Mark Excel Discussion (Misc queries) 1 December 23rd 04 05:51 PM


All times are GMT +1. The time now is 06:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"