Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Hiding rows based on cell content

I am trying to do the following and don't know where to start:

Look at every third cell in a column range. (A14:A50)
If that cell's value is 0 then that row plus the following 2 rows are
hidden.


Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Hiding rows based on cell content

A starter for ten..... (Caution an empty cell is evaluated as 0) !

Sub test()
Dim c As Range
For Each c In Range("A10:A50")
If c.Value = 0 Then
Rows(c.Row & ":" & c.Row + 2).EntireRow.Hidden = True
End If
Next c
End Sub

--

Regards,
Nigel




"Doug Howell" wrote in message
...
I am trying to do the following and don't know where to start:

Look at every third cell in a column range. (A14:A50)
If that cell's value is 0 then that row plus the following 2 rows are
hidden.


Thanks for any help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Hiding rows based on cell content

On Nov 3, 9:34*am, "Nigel" wrote:
A starter for ten..... (Caution an empty cell is evaluated as 0) !

Sub test()
Dim c As Range
For Each c In Range("A10:A50")
* If c.Value = 0 Then
* * *Rows(c.Row & ":" & c.Row + 2).EntireRow.Hidden = True
* End If
Next c
End Sub

--

Regards,
Nigel


"Doug Howell" wrote in message

...



I am trying to do the following and don't know where to start:


Look at every third cell in a column range. *(A14:A50)
If that cell's value is 0 then that row plus the following 2 rows are
hidden.


Thanks for any help.- Hide quoted text -


- Show quoted text -


Would the following work to ONLY look at every 3rd cell?

Sub test()
Dim c As Range
For Each c In Range("A10:A50")
If c.Value = 0 Then
Rows(c.Row & ":" & c.Row + 2).EntireRow.Hidden = True
End If
c=c+3
Next c
End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Hiding rows based on cell content

Sheets("Bulk MO").Visible = True
Sheets("Bulk MO").Select
Sheets("Bulk MO").Unprotect
Dim lRow As Long
For lRow = 14 To 50 Step 3
If Cells(lRow, 1).Value = 0 Then
Rows(lRow & ":" & lRow + 2).EntireRow.Hidden = True
End If
Next
Sheets("Bulk MO").Protect
Sheets("Bulk MO").Visible = False


Gives an error:

Run-time error '1004':
Unable to set the Hidden property of the Range class


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Hiding rows based on cell content

Dim lRow As Long
With Sheets("Bulk MO")

.Unprotect

For lRow = 14 To 50 Step 3
If .Cells(lRow, 1).Value = 0 Then
.Rows(lRow & ":" & lRow + 2).EntireRow.Hidden = True
End If
Next

.Protect

End With


--

Regards,
Nigel




"Doug Howell" wrote in message
...
Sheets("Bulk MO").Visible = True
Sheets("Bulk MO").Select
Sheets("Bulk MO").Unprotect
Dim lRow As Long
For lRow = 14 To 50 Step 3
If Cells(lRow, 1).Value = 0 Then
Rows(lRow & ":" & lRow + 2).EntireRow.Hidden = True
End If
Next
Sheets("Bulk MO").Protect
Sheets("Bulk MO").Visible = False


Gives an error:

Run-time error '1004':
Unable to set the Hidden property of the Range class


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Hiding rows based on cell content

Thanks for your patience with a programming neophyte Nigel..........
works perfectly now.......

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
Hiding rows based on a cell? OX_Gambit Excel Worksheet Functions 3 July 10th 09 03:05 AM
Hiding rows based value of cell within row Legion_c18 Excel Discussion (Misc queries) 0 February 22nd 08 06:01 AM
Hiding Rows Based on Cell Value LarryP Excel Programming 2 December 4th 07 07:43 PM
Hiding rows based on cell content brutus Excel Programming 5 November 15th 05 03:39 AM
Hiding rows based on cell content alistair01[_4_] Excel Programming 2 February 3rd 04 01:58 PM


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