#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hide Zeros


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=529131

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Hide Zeros

See response in excel.misc.

--
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=529131



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Hide Zeros

Sub HideRowsWithZero()

Dim i As Long
Dim lCol As Long

'column to look for zero's
lCol = 1

Application.ScreenUpdating = False

For i = 1 To 100
If Cells(i, lCol) = 0 And _
Not IsEmpty(Cells(i, lCol)) Then
Cells(i, 1).EntireRow.Hidden = True
End If
Next

Application.ScreenUpdating = True

End Sub


RBS


"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=529131


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Hide Zeros

This should do it:

Sub HideRows()
Dim LRow As Long
Dim MyRng As Range
Dim c As Range

LRow = Cells(Rows.Count, "B").End(xlUp).Row
Set MyRng = Range("B1:B" & LRow)

For Each c In MyRng
If c.Value = "0" Then
c.EntireRow.Hidden = True
End If
Next c
End Sub

Mike F

"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=529131



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hide Zeros


I am having problems getting this to work.

I attach a file which perhaps will help you see my problems.

Thanks in advance

Pau

+-------------------------------------------------------------------
|Filename: Summary.zip
|Download: http://www.excelforum.com/attachment.php?postid=4570
+-------------------------------------------------------------------

--
PaulOakle
-----------------------------------------------------------------------
PaulOakley's Profile: http://www.excelforum.com/member.php...fo&userid=2510
View this thread: http://www.excelforum.com/showthread.php?threadid=52913



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Hide Zeros

Try this one.
If it doesn't work explain what is wrong, rather using attachements.


Sub HideRowsWithZero()

Dim i As Long
Dim lCol As Long
Dim LR As Long

'last row of data
LR = Cells(65536, 1).End(xlUp).Row

'column to look for zero's, in this case column B
lCol = 2

Application.ScreenUpdating = False

For i = 1 To LR
If Cells(i, lCol) = 0 And _
Not IsEmpty(Cells(i, lCol)) Then
Cells(i, 1).EntireRow.Hidden = True
End If
Next

Application.ScreenUpdating = True

End Sub


RBS


"PaulOakley" wrote
in message ...

I am having problems getting this to work.

I attach a file which perhaps will help you see my problems.

Thanks in advance

Paul


+-------------------------------------------------------------------+
|Filename: Summary.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4570 |
+-------------------------------------------------------------------+

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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hide Zeros


Apoligies, thought i it might have been the easiest way to show a
problem.

Let me explain the problem further,

I have changed the style of my sheet to try and accom the macro,

I want the macro to:

Check line 25 for any zero values, if a zero value occurs to hide the
column that corresponds with that row, which could be any column from
B-indefinate.

Does this explain the dilemma any further?


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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Hide Zeros

that corresponds with that row ??

You must try to explain a bit more clearly.

RBS

"PaulOakley" wrote
in message ...

Apoligies, thought i it might have been the easiest way to show a
problem.

Let me explain the problem further,

I have changed the style of my sheet to try and accom the macro,

I want the macro to:

Check line 25 for any zero values, if a zero value occurs to hide the
column that corresponds with that row, which could be any column from
B-indefinate.

Does this explain the dilemma any further?


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


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
hide zeros ralpha Excel Discussion (Misc queries) 2 February 10th 10 10:29 PM
hide zeros on pivot table Marcelo Excel Worksheet Functions 2 March 12th 08 07:19 PM
how do I hide zeros in a graphic? FLF Charts and Charting in Excel 4 February 7th 08 08:47 PM
hide zeros & negatives for date formulas kimdnw Excel Discussion (Misc queries) 2 February 8th 06 07:34 PM
is there a way to hide zeros in a line graph L Young Charts and Charting in Excel 6 January 22nd 05 01:48 AM


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

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

About Us

"It's about Microsoft Excel"