ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Hide Rows if cell value is (https://www.excelbanter.com/new-users-excel/88881-hide-rows-if-cell-value.html)

mohd21uk via OfficeKB.com

Hide Rows if cell value is
 
I would like to hide a row if certain values are entered in three cells. For
e.g. if United Kingdom is selected in Cell C3 and C5 and CI is selected from
cell C10, I would then have Row 16 hidden. I would like this to be
dynamically i.e. updated whenever the value in the cell changes.

Many thanks in advance.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...l-new/200605/1

Norman Jones

Hide Rows if cell value is
 
Hi Mohd,

Try:

'=============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("C3,C5,C10")

If Not Intersect(rng, Target) Is Nothing Then
Rows(16).EntireRow.Hidden = Range("C3").Value = _
"United Kingdom" And Range("C5").Value = _
"United Kingdom" And Range("C10") = "C1"
End If
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman



"mohd21uk via OfficeKB.com" <u20517@uwe wrote in message
news:6056580dee09e@uwe...
I would like to hide a row if certain values are entered in three cells.
For
e.g. if United Kingdom is selected in Cell C3 and C5 and CI is selected
from
cell C10, I would then have Row 16 hidden. I would like this to be
dynamically i.e. updated whenever the value in the cell changes.

Many thanks in advance.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...l-new/200605/1





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

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