Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default hide rows if cell in a column has no value

HI,

I found this code in another thread and edited it for the range. The
code works fine if nothing is in the cell. But in my cells there is a
formula. The results of these formulas (value of a cell on another
sheet). Sometime these values era simply nothing, but the code doesn't
hide the rows. It onlys hides the rows if everything is cleared. How
can this code be edited, so that the rows witk cells that have no
value (like "") ere hidden?

Sub HideRows()
Sheets("Shortlist").Select
Range("J8:eindprioriteit").EntireRow.Hidden = False
On Error Resume Next
Set rng = Range("J7:eindprioriteit").SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.Hidden = True
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default hide rows if cell in a column has no value

Have you thought of using data|filter|autofilter and using "not equal to"
blanks?

bernd wrote:

HI,

I found this code in another thread and edited it for the range. The
code works fine if nothing is in the cell. But in my cells there is a
formula. The results of these formulas (value of a cell on another
sheet). Sometime these values era simply nothing, but the code doesn't
hide the rows. It onlys hides the rows if everything is cleared. How
can this code be edited, so that the rows witk cells that have no
value (like "") ere hidden?

Sub HideRows()
Sheets("Shortlist").Select
Range("J8:eindprioriteit").EntireRow.Hidden = False
On Error Resume Next
Set rng = Range("J7:eindprioriteit").SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.Hidden = True
End If
End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default hide rows if cell in a column has no value

I've used some code which I usedin antoher file to delete empty rows.
Maybe of use for other people:

Sub hiderows3()
Dim NullRange As Range
Set NullRange = Nothing
For i = 1 To ActiveSheet.UsedRange.Rows.Count
If Range("J" & i).Value = "" Then
If NullRange Is Nothing Then
Set NullRange = (Cells(i, 1))
Else
Set NullRange = Union(NullRange, Cells(i, 1))
End If
End If
Next

If Not (NullRange Is Nothing) Then
NullRange.EntireRow.Hidden = True 'hide the rows which satisfy the
condition.
End If
End Sub

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 we can hide the rows no. 1,2,3,4,.. &Column no. A,B,C,D...AA SANDY Excel Worksheet Functions 2 March 26th 08 08:57 PM
Hide Rows using a returtn value in a column Carpe Diem Excel Programming 3 July 27th 07 06:43 PM
Macro to Hide rows based on value of column F Scott Marcus Excel Discussion (Misc queries) 10 October 27th 06 11:57 PM
hide column and rows m_john Excel Discussion (Misc queries) 2 November 4th 05 04:13 PM
chk box to filter or hide rows based on value in a column deanop Excel Programming 6 January 7th 05 02:27 AM


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