Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
What I'm trying to achieve is the automatic hiding of entire rows if the
value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
Right click your sheet tab, view code and paste this in Sub sonic() LastRow = Cells(Cells.Rows.Count, "B").End(xlUp).Row Set myrange = Range("B1:B" & LastRow) For Each c In myrange If c.Value < "" And c.Value < 1 Then c.EntireRow.Hidden = True End If Next End Sub Mike "Al" wrote: What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub hide_row()
For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell..Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Too many dots
Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Bob Phillips" wrote in message ... Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell..Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Bob, this seems to work for cells B6 and B9 only...but not the range. i.e. I
also have B7<1, but this row is not hidden. Thanks for your help! "Bob Phillips" wrote: Too many dots Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Bob Phillips" wrote in message ... Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell..Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I thought that was how you wanted it Al <g.
Try Sub hide_row() For Each cell In Range("B6:B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... Bob, this seems to work for cells B6 and B9 only...but not the range. i.e. I also have B7<1, but this row is not hidden. Thanks for your help! "Bob Phillips" wrote: Too many dots Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Bob Phillips" wrote in message ... Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell..Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Bob, many thanks. I'll give this one a go first thing in the morning once I'm
back in the office. Can you advise me a good place to start learning all this "VBA macro stuff"?! Al "Bob Phillips" wrote: I thought that was how you wanted it Al <g. Try Sub hide_row() For Each cell In Range("B6:B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... Bob, this seems to work for cells B6 and B9 only...but not the range. i.e. I also have B7<1, but this row is not hidden. Thanks for your help! "Bob Phillips" wrote: Too many dots Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Bob Phillips" wrote in message ... Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell..Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This is just what i've been looking for, but I also want blank cells included.
-- Medzzz "Bob Phillips" wrote: I thought that was how you wanted it Al <g. Try Sub hide_row() For Each cell In Range("B6:B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... Bob, this seems to work for cells B6 and B9 only...but not the range. i.e. I also have B7<1, but this row is not hidden. Thanks for your help! "Bob Phillips" wrote: Too many dots Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell.Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Bob Phillips" wrote in message ... Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell..Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm a newbie on macro function. here is my file
http://i228.photobucket.com/albums/e...onproblem3.jpg i want to create a macro that would automatically hide the blank cells (the cells cannot be deleted because it has formula) how do i go about it? "Bob Phillips" wrote: Sub hide_row() For Each cell In Range("B6,B9") cell.EntireRow.Hidden = cell..Value < 1 Next cell End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Al" wrote in message ... What I'm trying to achieve is the automatic hiding of entire rows if the value of a cell, in this case in column B, is < 1. The below example works...row 6 is hidden. Sub hide_row() If Range("B6").Value < 1 Then Range("B6").EntireRow.Hidden = True End Sub But when I try to impose this upon a range of column B, then, alas, not the desired result! If Range("B6,B9").Value < 1 Then Range("B6,B9").EntireRow.Hidden = True Can anyone point me in the right direction? Thanks in advance! Al |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro/code to hide rows | Excel Worksheet Functions | |||
Macro to Hide rows based on value of column F | Excel Discussion (Misc queries) | |||
Macro that will unhide then hide rows | Excel Discussion (Misc queries) | |||
hide rows with macro | Excel Discussion (Misc queries) | |||
macro to hide rows | Excel Discussion (Misc queries) |