A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

macro - hide rows



 
 
Thread Tools Display Modes
  #1  
Old September 17th, 2003, 05:21 AM
Will
external usenet poster
 
Posts: n/a
Default macro - hide rows

I will try this again but I do not understand all the
lingo so please lead me.

Cells A2:A60 contain formulas that return a result of
either "" or a number. Question is - Could the result
of "" from that formula (say in A4) be enough to trigger
HIDING row 4 ?? I will unhide them as I need unless it is
possible at the same time to unhide row 4 should the
result of A4 ever become a number.
If possible please do tell. I went the wrong route before
by right clicking the sheet tab and going to view code.

Thanks greatly for any help........Will

  #2  
Old September 17th, 2003, 02:15 PM
Eric
external usenet poster
 
Posts: n/a
Default macro - hide rows

One way that I found that worked for this is the following:

In the Sheet Code area,

Private Sub Worksheet_Calculate()
Dim ToHide as Integer
For ToHide = 2 to 60
If Cells(ToHide, 1).Value = "" Then
Rows(ToHide).Hidden = True
Else
Rows(ToHide).Hidden = False
End If
Next ToHide
End Sub


There may be other ways, but it worked for me. Hope it does the same
for you.


On Tue, 16 Sep 2003 21:21:39 -0700, "Will"
wrote:

I will try this again but I do not understand all the
lingo so please lead me.

Cells A2:A60 contain formulas that return a result of
either "" or a number. Question is - Could the result
of "" from that formula (say in A4) be enough to trigger
HIDING row 4 ?? I will unhide them as I need unless it is
possible at the same time to unhide row 4 should the
result of A4 ever become a number.
If possible please do tell. I went the wrong route before
by right clicking the sheet tab and going to view code.

Thanks greatly for any help........Will


  #3  
Old September 17th, 2003, 04:15 PM
Rajesh
external usenet poster
 
Posts: n/a
Default macro - hide rows

Will
Try the code below
Rajesh

Sub HideRows()
Dim RowNo As Integer
RowNo = 2
Cells.Select
Selection.EntireRow.Hidden = False
Cells(2, 1).Select
For i = 1 To 59
Cellvalue = Sheets(1).Cells(RowNo, 1).Value
If Cellvalue = "" Then
Add = ActiveCell.Address
Rows(RowNo).Select
Selection.EntireRow.Hidden = True
End If
RowNo = RowNo + 1
Next i
End Sub




-----Original Message-----
I will try this again but I do not understand all the
lingo so please lead me.

Cells A2:A60 contain formulas that return a result of
either "" or a number. Question is - Could the result
of "" from that formula (say in A4) be enough to trigger
HIDING row 4 ?? I will unhide them as I need unless it is
possible at the same time to unhide row 4 should the
result of A4 ever become a number.
If possible please do tell. I went the wrong route before
by right clicking the sheet tab and going to view code.

Thanks greatly for any help........Will

.

  #4  
Old September 17th, 2003, 10:18 PM
Will
external usenet poster
 
Posts: n/a
Default macro - hide rows

Eric !! that's it. Worked great. Much Thanks.....Will


-----Original Message-----
One way that I found that worked for this is the

following:

In the Sheet Code area,

Private Sub Worksheet_Calculate()
Dim ToHide as Integer
For ToHide = 2 to 60
If Cells(ToHide, 1).Value = "" Then
Rows(ToHide).Hidden = True
Else
Rows(ToHide).Hidden = False
End If
Next ToHide
End Sub


There may be other ways, but it worked for me. Hope it

does the same
for you.


On Tue, 16 Sep 2003 21:21:39 -0700, "Will"


wrote:

I will try this again but I do not understand all the
lingo so please lead me.

Cells A2:A60 contain formulas that return a result of
either "" or a number. Question is - Could the result
of "" from that formula (say in A4) be enough to trigger
HIDING row 4 ?? I will unhide them as I need unless it

is
possible at the same time to unhide row 4 should the
result of A4 ever become a number.
If possible please do tell. I went the wrong route

before
by right clicking the sheet tab and going to view code.

Thanks greatly for any help........Will


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:14 PM.


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