Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default MACRO TO HIDE BLANK ROWS

I have developed a model that has 190 lines but certain cells are blank ie
(-) and i would like to hide that row were a certain cell is blank. How do I
write code for the macro to start at say C1 and then move down to C2 etc and
then when it finds a cell that is blank ( but contains a lookup formula) it
will hide that row and then continue until say come to c192 which contains
the word END. Can anybody help me please.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default MACRO TO HIDE BLANK ROWS

Sub hideum()
Set r = Range("C2:C192")
For i = 1 To 192
If Cells(i, "C").Value = "" Then
Rows(i).Hidden = True
End If
Next
End Sub

--
Gary''s Student - gsnu200819


"keyson2004" wrote:

I have developed a model that has 190 lines but certain cells are blank ie
(-) and i would like to hide that row were a certain cell is blank. How do I
write code for the macro to start at say C1 and then move down to C2 etc and
then when it finds a cell that is blank ( but contains a lookup formula) it
will hide that row and then continue until say come to c192 which contains
the word END. Can anybody help me please.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MACRO TO HIDE BLANK ROWS


A cell can not be both blank & contain a formula

Do you mean you want to hide the row if the result of the formula is ""


--
mudraker

If my reply has assisted or failed to assist you I welcome your
Feedback.

www.thecodecage.com
------------------------------------------------------------------------
mudraker's Profile: http://www.thecodecage.com/forumz/member.php?userid=18
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=39599

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default MACRO TO HIDE BLANK ROWS

Sub DeleteBlanks()
Dim rng As Range
Dim LastRow As Long

Columns("D").Insert
Range("D1").Value = "Flag"
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
Range("D2").Resize(LastRow - 1).Formula = "=C2="""""
Columns("D").AutoFilter field:=1, Criteria1:="=TRUE"
On Error Resume Next
Set rng = Range("D2").Resize(LastRow -
1).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
Columns("D").Delete
End Sub


--
__________________________________
HTH

Bob

"keyson2004" wrote in message
...
I have developed a model that has 190 lines but certain cells are blank ie
(-) and i would like to hide that row were a certain cell is blank. How do
I
write code for the macro to start at say C1 and then move down to C2 etc
and
then when it finds a cell that is blank ( but contains a lookup formula)
it
will hide that row and then continue until say come to c192 which contains
the word END. Can anybody help me please.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default MACRO TO HIDE BLANK ROWS

Hi, Yes

"mudraker" wrote:


A cell can not be both blank & contain a formula

Do you mean you want to hide the row if the result of the formula is ""


--
mudraker

If my reply has assisted or failed to assist you I welcome your
Feedback.

www.thecodecage.com
------------------------------------------------------------------------
mudraker's Profile: http://www.thecodecage.com/forumz/member.php?userid=18
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=39599




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default MACRO TO HIDE BLANK ROWS

Hi Thanks for this. How do move to the next cell until it finds anonther cell
("") ??

"Gary''s Student" wrote:

Sub hideum()
Set r = Range("C2:C192")
For i = 1 To 192
If Cells(i, "C").Value = "" Then
Rows(i).Hidden = True
End If
Next
End Sub

--
Gary''s Student - gsnu200819


"keyson2004" wrote:

I have developed a model that has 190 lines but certain cells are blank ie
(-) and i would like to hide that row were a certain cell is blank. How do I
write code for the macro to start at say C1 and then move down to C2 etc and
then when it finds a cell that is blank ( but contains a lookup formula) it
will hide that row and then continue until say come to c192 which contains
the word END. Can anybody help me please.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default MACRO TO HIDE BLANK ROWS

The macro examines the cells in seuqence:
C1, C2, C3, ....C192
If it find a blank in a cell, the row is hidden.
--
Gary''s Student - gsnu200819
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
Macro to HIDE blank rows JForsyth Excel Worksheet Functions 6 June 5th 09 04:51 PM
Macro to Hide blank rows manfareed Excel Programming 4 May 21st 08 10:00 AM
Macro hide rows with blank data in cells [email protected] Excel Programming 6 August 22nd 07 09:10 PM
Macro to hide blank rows Alan Smith Excel Programming 3 February 23rd 07 04:35 PM
macro to hide rows if cell is blank Shooter Excel Worksheet Functions 3 September 28th 05 10:55 PM


All times are GMT +1. The time now is 09:03 PM.

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"