Dropdown hiding other cells goes wrong

ddewilt

New Member
Joined
Sep 18, 2017
Messages
26
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!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,911
Messages
6,122,194
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top