ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding A Row (https://www.excelbanter.com/excel-programming/335269-hiding-row.html)

Dan G.[_2_]

Hiding A Row
 
Hello.

I am trying to hide a row based on a value in a cell within the row. I
need this to take place as the sheet re-calculates after a different
selection is made from the Forms combo-box.

Not sure why I'm having issues, as this should be pretty
straightforward.

Any help would be greatly appreciated.

Thanks.

Dan

*** Sent via Developersdex http://www.developersdex.com ***

PCLIVE

Hiding A Row
 
Dan,

I'm not sure if you need to reference multiple rows or if it would always be
the same row that would be hidden. However, you could try something like
this.
This is based of the cell contents of A20 being "q" in which row 20 would
automatically hide.

If Range("A20").Value = "q" Then Rows(20).EntireRow.Hidden = True Else
Rows(20).EntireRow.Hidden = False

For this to work automatically, right-click on the current worksheet at the
bottom and select View Code. Then click the drop-down to select Worksheet.
Then verify that the other drop-down is on SelectionChange.

HTH,
Paul

"Dan G." wrote in message
...
Hello.

I am trying to hide a row based on a value in a cell within the row. I
need this to take place as the sheet re-calculates after a different
selection is made from the Forms combo-box.

Not sure why I'm having issues, as this should be pretty
straightforward.

Any help would be greatly appreciated.

Thanks.

Dan

*** Sent via Developersdex http://www.developersdex.com ***




Tom Ogilvy

Hiding A Row
 
Dim cell as Range
rows.Hidden = False
for each cell in Range("C1:C200")
if cell.Value = 3 then
rows(cell.Row).Hidden = True
exit for
end if
Next

--
Regards,
Tom Ogilvy

"Dan G." wrote in message
...
Hello.

I am trying to hide a row based on a value in a cell within the row. I
need this to take place as the sheet re-calculates after a different
selection is made from the Forms combo-box.

Not sure why I'm having issues, as this should be pretty
straightforward.

Any help would be greatly appreciated.

Thanks.

Dan

*** Sent via Developersdex http://www.developersdex.com ***




Dan G.[_2_]

Hiding A Row
 

I understand the code, and either would suffice. The problem I have is
having it execute upon a change in the drop-down.

Currently values re-calculate on the sheet in a series of INDEX
formulas. If you activate another cell on the sheet it works fine. If
you only change the drop down box, and don't select another cell, the
code does not execute.

What do you recommend?


*** Sent via Developersdex http://www.developersdex.com ***

STEVE BELL

Hiding A Row
 
You might try using the change event instead of the selection change event.

Of course some drop downs have their own events and the one to look for
would most likely be the exit event (or the change event but this one
activates each
time a single character is typed into the drop down)

--
steveB

Remove "AYN" from email to respond
"Dan G." wrote in message
...

I understand the code, and either would suffice. The problem I have is
having it execute upon a change in the drop-down.

Currently values re-calculate on the sheet in a series of INDEX
formulas. If you activate another cell on the sheet it works fine. If
you only change the drop down box, and don't select another cell, the
code does not execute.

What do you recommend?


*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com