How to write if condition

guptasweb

New Member
Joined
Jun 17, 2024
Messages
21
Office Version
  1. 2019
Platform
  1. Windows
I want to check in the whole sheet if it contains these rows
TIA
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
What rows?
RawData.xlsx
ABCDEFGHIJKL
1North American Forging 2024 OEE Scorecard
2PlantPressTargetJAN-2024FEB-2024MAR-2024APR-2024MAY-2024JUN-2024JUL-2024AUG-2024
3ActualActualActualActualActualActualActualActual
4AHMCLine 165.0%49.0%56.5%50.0%55.0%
5Line 265.0%41.0%
6Line 365.0%43.0%55.4%46.0%45.0%
7Line 665.0%41.0%43.0%53.0%40.0%
8Line 765.0%55.0%56.3%63.0%66.0%
910R8085.0%72.0%72.0%73.4%73.0%
10S1 Line85.0%70.0%71.0%69.0%71.0%
11S4 Line85.0%71.0%74.6%74.3%72.0%
12CD685.0%74.0%79.0%76.0%81.0%
13
14PlantPressTargetJAN-2024FEB-2024MAR-2024APR-2024MAY-2024JUN-2024JUL-2024AUG-2024
15ActualActualActualActualActualActualActualActual
16CIMF-2Line 165.0%51.9%55.5%56.8%60.9%
17Line 265.0%53.1%53.0%51.8%61.8%
18
19PlantPressTargetJAN-2024FEB-2024MAR-2024APR-2024MAY-2024JUN-2024JUL-2024AUG-2024
20ActualActualActualActualActualActualActualActual
Actual
 
Upvote 0
RawData.xlsx
ABCDEFGHIJKL
1North American Forging 2024 OEE Scorecard
2PlantPressTargetJAN-2024FEB-2024MAR-2024APR-2024MAY-2024JUN-2024JUL-2024AUG-2024
3ActualActualActualActualActualActualActualActual
4AHMCLine 165.0%49.0%56.5%50.0%55.0%
5Line 265.0%41.0%
6Line 365.0%43.0%55.4%46.0%45.0%
7Line 665.0%41.0%43.0%53.0%40.0%
8Line 765.0%55.0%56.3%63.0%66.0%
910R8085.0%72.0%72.0%73.4%73.0%
10S1 Line85.0%70.0%71.0%69.0%71.0%
11S4 Line85.0%71.0%74.6%74.3%72.0%
12CD685.0%74.0%79.0%76.0%81.0%
13
14PlantPressTargetJAN-2024FEB-2024MAR-2024APR-2024MAY-2024JUN-2024JUL-2024AUG-2024
15ActualActualActualActualActualActualActualActual
16CIMF-2Line 165.0%51.9%55.5%56.8%60.9%
17Line 265.0%53.1%53.0%51.8%61.8%
18
19PlantPressTargetJAN-2024FEB-2024MAR-2024APR-2024MAY-2024JUN-2024JUL-2024AUG-2024
20ActualActualActualActualActualActualActualActual
Actual
I want to remove row no 14& 15,19&20 and so on
 
Upvote 0
It will take VBA to do that, but since those are the only lines other than the top headers that are bold, you should just be able to check for that.

VBA Code:
Sub RemoveDuplicateHeaders()
Dim x As Long, y As Long
x = Range("L" & Rows.Count).End(xlUp).Row
For y = x To 4 Step -1
    If Cells(y, 12).Font.Bold = True Then Rows(y).Delete
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,588
Messages
6,160,654
Members
451,662
Latest member
reelspike

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