Delete Rows based on criteria

HockeyDiablo

Board Regular
Joined
Apr 1, 2016
Messages
182
Good afternoon, looking to remove some rows if cells equaled a certain text

Rows 17-19 ~ AT11 = MS18
Rows 20-22 ~ AT12 = FB18
Rows 23-25 ~ AT13 = STS18
Rows 26-28 ~ AT14 = MH18
Rows 29-31 ~ AT15 = FS18
Rows 32-34 ~ AT16 = SFS18

Here is what I have researched thus far but it can only do one?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Rows("26:28").EntireRow.Hidden = IIf(UCase(Range("AT14")) = "MH18", False, True)
End Sub



Apparently "Worksheet_Change" is something I have never encountered. Thanks

J
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
try this:
Code:
Option Explicit


Sub Foo()
If Range("AT11") = "MS18" Then Rows("17:19").Hidden = True
If Range("AT12") = "FB18" Then Rows("20:22").Hidden = True
If Range("AT13") = "STS18" Then Rows("23:25").Hidden = True
If Range("AT14") = "MH18" Then Rows("26:28").Hidden = True
If Range("AT15") = "FS18" Then Rows("29:31").Hidden = True
If Range("AT16") = "SFS18" Then Rows("32:34").Hidden = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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