delete rows if there are "no data"

jaik22

Board Regular
Joined
Sep 23, 2016
Messages
102
I would like to write a vba code that if find a row contains "No Data" then delete seven rows to up.
Code:
[TABLE="width: 516"]
<colgroup><col span="7"><col></colgroup><tbody>[TR]
[TD]RSV[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]134[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ATN[/TD]
[TD]AT[/TD]
[TD]OT[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Close[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Name[/TD]
[TD]NA[/TD]
[TD]DT[/TD]
[TD]CRA[/TD]
[TD]ADJC[/TD]
[TD] ADJ[/TD]
[TD]NA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"]No Data Found for selected [/TD]
[/TR]
</tbody>[/TABLE]

So sample data is like that, and I want macro to delete seven rows from No Data row to RSV row.

Is there any way to make this kind of macro, to delete all fields having No Data?

Thank you!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I would like to write a vba code that if find a row contains "No Data" then delete seven rows to up.
Code:
[TABLE="class: grid, width: 80%, align: center"]
<tbody>[TR]
[TD]RSV
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]134[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ATN[/TD]
[TD]AT[/TD]
[TD]OT[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Close[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Name[/TD]
[TD]NA[/TD]
[TD]DT[/TD]
[TD]CRA[/TD]
[TD]ADJC[/TD]
[TD] ADJ[/TD]
[TD]NA[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"]No Data Found for selected[/TD]
[/TR]
</tbody>[/TABLE]

So sample data is like that, and I want macro to delete seven rows from No Data row to RSV row.

Is there any way to make this kind of macro, to delete all fields having No Data?

Thank you!
There is a way. Is there a maximum width to the number of columns?
 
Upvote 0
for this workbook, i have 30661 rows, but number of rows are different if I open up the other workbook.

Thank you so much for your support!
 
Upvote 0
for this workbook, i have 30661 rows, but number of rows are different...

That's fair enough, but what about columns, as asked in my previous post?

In your example there are only 8 columns which means I can shorten the search time down greatly. If there are 30,000+ columns then it will take longer.
 
Upvote 0

Forum statistics

Threads
1,214,625
Messages
6,120,598
Members
448,973
Latest member
ksonnia

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