Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Hide / UnHide - is there a Function to automate this ?

Hello all, does anyone know if there is a way to create a function to
Automatically Hide a Row based on a formula

In thise case if a Cell in a row (a1 for arguements sake) = 0

It would help me tidy up a work book if I could do this.

Thanks Andy


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Hide / UnHide - is there a Function to automate this ?

Andrew,

You could monitor A1 with code and if it is set to a value you want then
hide rows:
Right click the worksheet tab - view code and paste this in.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub

If A1 is set to zero it hides row 4 but you can change the ranges and values
to suit.

Mike


"Andrew Duncan" wrote:

Hello all, does anyone know if there is a way to create a function to
Automatically Hide a Row based on a formula

In thise case if a Cell in a row (a1 for arguements sake) = 0

It would help me tidy up a work book if I could do this.

Thanks Andy



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Hide / UnHide - is there a Function to automate this ?

Thanks Mike,

And if I wanted to monitor rows from 1 to 250 and on the same basis hide any
rows that are empty Would the following work:


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A1:$A250" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub


Would the usual 'Hide' and 'UnHide' (right clicking ) also work or would
that now be disabled ?

Andy




"Mike H" wrote in message
...
Andrew,

You could monitor A1 with code and if it is set to a value you want then
hide rows:
Right click the worksheet tab - view code and paste this in.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub

If A1 is set to zero it hides row 4 but you can change the ranges and
values
to suit.

Mike


"Andrew Duncan" wrote:

Hello all, does anyone know if there is a way to create a function to
Automatically Hide a Row based on a formula

In thise case if a Cell in a row (a1 for arguements sake) = 0

It would help me tidy up a work book if I could do this.

Thanks Andy





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Hide / UnHide - is there a Function to automate this ?

No effect on any other worksheet functionality.

Mike

"Andrew Duncan" wrote:

Thanks Mike,

And if I wanted to monitor rows from 1 to 250 and on the same basis hide any
rows that are empty Would the following work:


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A1:$A250" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub


Would the usual 'Hide' and 'UnHide' (right clicking ) also work or would
that now be disabled ?

Andy




"Mike H" wrote in message
...
Andrew,

You could monitor A1 with code and if it is set to a value you want then
hide rows:
Right click the worksheet tab - view code and paste this in.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub

If A1 is set to zero it hides row 4 but you can change the ranges and
values
to suit.

Mike


"Andrew Duncan" wrote:

Hello all, does anyone know if there is a way to create a function to
Automatically Hide a Row based on a formula

In thise case if a Cell in a row (a1 for arguements sake) = 0

It would help me tidy up a work book if I could do this.

Thanks Andy






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Hide / UnHide - is there a Function to automate this ?

Sorry I missed your question. No that wont work, to monitor a range of cells
try:-

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:A100")) _
Is Nothing Then Exit Sub
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End Sub

"Andrew Duncan" wrote:

Thanks Mike,

And if I wanted to monitor rows from 1 to 250 and on the same basis hide any
rows that are empty Would the following work:


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A1:$A250" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub


Would the usual 'Hide' and 'UnHide' (right clicking ) also work or would
that now be disabled ?

Andy




"Mike H" wrote in message
...
Andrew,

You could monitor A1 with code and if it is set to a value you want then
hide rows:
Right click the worksheet tab - view code and paste this in.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub

If A1 is set to zero it hides row 4 but you can change the ranges and
values
to suit.

Mike


"Andrew Duncan" wrote:

Hello all, does anyone know if there is a way to create a function to
Automatically Hide a Row based on a formula

In thise case if a Cell in a row (a1 for arguements sake) = 0

It would help me tidy up a work book if I could do this.

Thanks Andy








  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Hide / UnHide - is there a Function to automate this ?

Mike,

Thanks for your patience.
I have a spreadsheet with 507 rows in it.
At various times when accessed other worksheets may or may not of inputted
data in to some or all of those rows.
i.e.

row A
6 clive
7 0
8 apple
9 pear
10 0
11 0
12 0
13 kart
14 bike
15 0


Rather than manually hidding or unhiding the rows with no data in column A
of the Rows can we create the code to review rows 6 through 507 and hide any
that have Zero in the A column ?

Andy




"Mike H" wrote in message
...
Sorry I missed your question. No that wont work, to monitor a range of
cells
try:-

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:A100")) _
Is Nothing Then Exit Sub
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End Sub

"Andrew Duncan" wrote:

Thanks Mike,

And if I wanted to monitor rows from 1 to 250 and on the same basis hide
any
rows that are empty Would the following work:


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A1:$A250" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub


Would the usual 'Hide' and 'UnHide' (right clicking ) also work or would
that now be disabled ?

Andy




"Mike H" wrote in message
...
Andrew,

You could monitor A1 with code and if it is set to a value you want
then
hide rows:
Right click the worksheet tab - view code and paste this in.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub

If A1 is set to zero it hides row 4 but you can change the ranges and
values
to suit.

Mike


"Andrew Duncan" wrote:

Hello all, does anyone know if there is a way to create a function to
Automatically Hide a Row based on a formula

In thise case if a Cell in a row (a1 for arguements sake) = 0

It would help me tidy up a work book if I could do this.

Thanks Andy








  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Hide / UnHide - is there a Function to automate this ?

Andrew,

Does this work?

Sub marine()
For x = 507 To 1 Step -1
Cells(x, 1).Select
If ActiveCell.Value < "" And ActiveCell.Value = 0 Then
Selection.EntireRow.Hidden = True
End If
Next
End Sub

Mike

"Andrew Duncan" wrote:

Mike,

Thanks for your patience.
I have a spreadsheet with 507 rows in it.
At various times when accessed other worksheets may or may not of inputted
data in to some or all of those rows.
i.e.

row A
6 clive
7 0
8 apple
9 pear
10 0
11 0
12 0
13 kart
14 bike
15 0


Rather than manually hidding or unhiding the rows with no data in column A
of the Rows can we create the code to review rows 6 through 507 and hide any
that have Zero in the A column ?

Andy




"Mike H" wrote in message
...
Sorry I missed your question. No that wont work, to monitor a range of
cells
try:-

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:A100")) _
Is Nothing Then Exit Sub
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End Sub

"Andrew Duncan" wrote:

Thanks Mike,

And if I wanted to monitor rows from 1 to 250 and on the same basis hide
any
rows that are empty Would the following work:


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A1:$A250" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub


Would the usual 'Hide' and 'UnHide' (right clicking ) also work or would
that now be disabled ?

Andy




"Mike H" wrote in message
...
Andrew,

You could monitor A1 with code and if it is set to a value you want
then
hide rows:
Right click the worksheet tab - view code and paste this in.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If Target.Value = 0 Then
Rows(4).Select '< Change to suit
Selection.EntireRow.Hidden = True
End If
End If

End Sub

If A1 is set to zero it hides row 4 but you can change the ranges and
values
to suit.

Mike


"Andrew Duncan" wrote:

Hello all, does anyone know if there is a way to create a function to
Automatically Hide a Row based on a formula

In thise case if a Cell in a row (a1 for arguements sake) = 0

It would help me tidy up a work book if I could do this.

Thanks Andy









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/unhide brownti Excel Discussion (Misc queries) 3 February 6th 07 07:14 PM
Hide Unhide Colin Excel Discussion (Misc queries) 4 April 9th 06 05:01 PM
Hide/unhide Jock W Excel Worksheet Functions 4 October 4th 05 05:02 PM
Exce Hide / Unhide function MJM Excel Worksheet Functions 3 June 21st 05 01:32 AM
Hide and unhide Marcel Excel Discussion (Misc queries) 1 March 10th 05 11:50 PM


All times are GMT +1. The time now is 11:15 PM.

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"