Multiple Rows to hide in VB

GlennY

Board Regular
Joined
Jan 22, 2009
Messages
103
I have a dropdown with 2 selections (PHYSICAL & VIRTUAL).
If Physical is selected i need to hide rows 31 thru 70 and display rows 13 thru 30
If Virtual is selected i need to hide rows 13 thru 30 and display rows 31 thru 70.

I am trying to do this in the Microsoft VB code (below) but i cannot get it to work properly.


If Not Intersect(Target, Range("B11")) Is Nothing Then
If Range("B11") = "Virtual" Then
Rows("31:70").Hidden = False
Else
Rows("13:30").Hidden = True
End If
End If
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try

Code:
If Not Intersect(Target, Range("B11")) Is Nothing Then
    If Range("B11") = "Virtual" Then
        Rows("31:70").Hidden = False
        Rows("13:30").Hidden = True
    Else
        Rows("13:30").Hidden = False
        Rows("31:70").Hidden = True
    End If
End If
 
Upvote 0
Hi

Try:

Code:
If Not Intersect(Target, Range("B11")) Is Nothing Then
    Rows("13:30").Hidden = (Range("B11") = "Virtual")
    Rows("31:70").Hidden = (Range("B11") = "Physical")
End If
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

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