Dropdown hiding other cells goes wrong

ddewilt

New Member
Joined
Sep 18, 2017
Messages
20
I've got a code from one of you guy's and it works perfectly, but if I change any other dropdown on the sheet 'Panelen en Omvormers', the rows disappear again..:confused:.. very strange..

Here is my sheet code now: (the above code is another code which hides a cell on the same sheet, that's not the code I am talking about)
The code I got begins after the first 'End If'.

Code:

Private Sub Worksheet_Change(ByVal Target As Range)
Const BeginRow = 35 ' seems better than 1 to me
Const EndRow = 50
Const ChkCol = 2 ' column B
Const NACol = 22 ' column G
Const PLCell = "F18" ' cell with dropdown
Dim RowCnt As Long
Dim Flag As Boolean

If Not Intersect(Me.Range(PLCell), Target) Is Nothing Then
Application.EnableEvents = False
Application.ScreenUpdating = False
Flag = (Me.Range(PLCell).Value = "Nee")
For RowCnt = BeginRow To EndRow
Cells(RowCnt, ChkCol).EntireRow.Hidden = Flag Or _
(Cells(RowCnt, ChkCol).Value = 1)
Next RowCnt
Application.ScreenUpdating = True
Application.EnableEvents = True
End If

Dim wsog As Worksheet
Dim wspo As Worksheet




Set wsog = Worksheets("4. OPTIONELE GEGEVENS")
Set wspo = Worksheets("3. PANELEN EN OMVORMERS")




wsog.Rows("4:8").EntireRow.Hidden = True
wsog.Rows("9:11").EntireRow.Hidden = True






If Not Intersect(Target, wspo.Range("F55")) Is Nothing Then
If UCase(wspo.Range("F55")) = "ENPHASE" Then wsog.Rows("4:8").EntireRow.Hidden = True
If UCase(wspo.Range("F55")) = "ENPHASE" Then wsog.Rows("9:11").EntireRow.Hidden = False
If UCase(wspo.Range("F55")) = "SOLAR_EDGE" Then wsog.Rows("9:11").EntireRow.Hidden = True
If UCase(wspo.Range("F55")) = "SOLAR_EDGE" Then wsog.Rows("4:8").EntireRow.Hidden = False
End If




End Sub

So, I select in dropdown cell F55 'SOLAR_EDGE', then the right cells appear and the rest disappears, that's ok. But the drop down underneath it, dropdown cell F58 (or any other dropdown cell in that sheet) makes the cells which appeared, disappear.. :confused:

You know what is wrong here?

Thankss!
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Watch MrExcel Video

Forum statistics

Threads
1,099,699
Messages
5,470,274
Members
406,686
Latest member
BNR_ 1980

This Week's Hot Topics

Top