#1   Report Post  
Posted to microsoft.public.excel.misc
PaulOakley
 
Posts: n/a
Default Hide Zero Values


Hello,

I need to run a macro to hide any rows that contain a zero value in a
certain column number. e.g hide all rows that contain a zero value in
column B?

Is this possible do you think?

Thanks in advance

Paul


--
PaulOakley
------------------------------------------------------------------------
PaulOakley's Profile: http://www.excelforum.com/member.php...o&userid=25103
View this thread: http://www.excelforum.com/showthread...hreadid=529130

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Hide Zero Values

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim rng As rng

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "B").Value = 0 Then
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next i

If Not rng Is Nothing Then rng.Hidden = True

End Sub



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"PaulOakley" wrote
in message ...

Hello,

I need to run a macro to hide any rows that contain a zero value in a
certain column number. e.g hide all rows that contain a zero value in
column B?

Is this possible do you think?

Thanks in advance

Paul


--
PaulOakley
------------------------------------------------------------------------
PaulOakley's Profile:

http://www.excelforum.com/member.php...o&userid=25103
View this thread: http://www.excelforum.com/showthread...hreadid=529130



  #3   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Hide Zero Values

Typo:

Dim rng as Range

HTH
--
AP

"Bob Phillips" a écrit dans le message
de ...
Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim rng As rng

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "B").Value = 0 Then
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next i

If Not rng Is Nothing Then rng.Hidden = True

End Sub



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"PaulOakley"

wrote
in message ...

Hello,

I need to run a macro to hide any rows that contain a zero value in a
certain column number. e.g hide all rows that contain a zero value in
column B?

Is this possible do you think?

Thanks in advance

Paul


--
PaulOakley
------------------------------------------------------------------------
PaulOakley's Profile:

http://www.excelforum.com/member.php...o&userid=25103
View this thread:

http://www.excelforum.com/showthread...hreadid=529130





  #4   Report Post  
Posted to microsoft.public.excel.misc
PaulOakley
 
Posts: n/a
Default Hide Zero Values


Seems to be coming back with error msg of "user defined ype not
defined"

Dim rng As rng- this part is being highlighted, is this right, or
should i be entering data here


--
PaulOakley
------------------------------------------------------------------------
PaulOakley's Profile: http://www.excelforum.com/member.php...o&userid=25103
View this thread: http://www.excelforum.com/showthread...hreadid=529130

  #5   Report Post  
Posted to microsoft.public.excel.misc
PaulOakley
 
Posts: n/a
Default Hide Zero Values


If Not rng Is Nothing Then rng.Hidden = True

This is now showing as a debug error.. I know very little VBA, so dont
seem to be able to change the error..

Thanks in advance


--
PaulOakley
------------------------------------------------------------------------
PaulOakley's Profile: http://www.excelforum.com/member.php...o&userid=25103
View this thread: http://www.excelforum.com/showthread...hreadid=529130



  #6   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Hide Zero Values

Thanks mate.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Ardus Petus" wrote in message
...
Typo:

Dim rng as Range

HTH
--
AP

"Bob Phillips" a écrit dans le message
de ...
Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim rng As rng

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "B").Value = 0 Then
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next i

If Not rng Is Nothing Then rng.Hidden = True

End Sub



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"PaulOakley"

wrote
in message

...

Hello,

I need to run a macro to hide any rows that contain a zero value in a
certain column number. e.g hide all rows that contain a zero value in
column B?

Is this possible do you think?

Thanks in advance

Paul


--
PaulOakley


------------------------------------------------------------------------
PaulOakley's Profile:

http://www.excelforum.com/member.php...o&userid=25103
View this thread:

http://www.excelforum.com/showthread...hreadid=529130







  #7   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Hide Zero Values

Paul,

Ardus pointed out a typo, and I need a bit more property

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim rng As Range

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "B").Value = 0 Then
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next i

If Not rng Is Nothing Then rng.EntireRow.Hidden = True

End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"PaulOakley" wrote
in message ...

If Not rng Is Nothing Then rng.Hidden = True

This is now showing as a debug error.. I know very little VBA, so dont
seem to be able to change the error..

Thanks in advance


--
PaulOakley
------------------------------------------------------------------------
PaulOakley's Profile:

http://www.excelforum.com/member.php...o&userid=25103
View this thread: http://www.excelforum.com/showthread...hreadid=529130



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
how to hide 0 values in pivot table maryj Excel Discussion (Misc queries) 3 April 1st 06 09:49 AM
hide 0 values in ptable maryj Excel Discussion (Misc queries) 0 March 29th 06 04:22 PM
Hide all values in a row if value is 0 Erik T Excel Worksheet Functions 1 March 16th 06 12:20 AM
How do I hide 0 values in line charts Stephan Charts and Charting in Excel 2 April 12th 05 12:55 PM
Excel - hide erroer values Kathrine J Wathne Excel Discussion (Misc queries) 1 January 10th 05 10:13 PM


All times are GMT +1. The time now is 08:36 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"