Macro help (delete rows based on row value)

Obied70

Board Regular
Joined
Nov 4, 2015
Messages
177
Office Version
  1. 365
Platform
  1. Windows
Hi All,
I need some help from all of you geniuses. I'd like to utilize a macro to delete rows in a spreadsheet based on a repeating set of formats. In the table below, the macro would need to start deleting at the first empty row (2) and finish with deleting the last row "Date/Time Origination." If it makes it easier, the final row is always colored blue. Any help would be great, thanks![TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]May 18, 2018 5:02:02 PM EDT[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="width: 184"]blank[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]blank[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]Originating or Terminating CUCM End User:[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]Department: Sales[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]Outbound Calls: 22[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]Average Outbound Duration: 00:07:14[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]Total Outbound Duration: 02:39:27[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]blank[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]Call Details[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 184"]
<tbody>[TR]
[TD="class: xl65, width: 184"]Date/Time Origination[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
In that case could you post some more data so that I can see what is needed.
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
the add-ins are not working on this machine for whatever reason so I can't get my worksheet posted however all i need is for the code youve already posted to repeat itself until it reaches the end of the sheet.
 
Upvote 0
You can try this, but I've no idea if it will work.
Code:
Sub DelRws()
Dim i As Long
For i = 1 To Application.CountIf(Range("A:A"), "Date/Time Origination")
   With Range("A:A")
      .Replace "Date/Time Origination", "=XXX", xlWhole, , False, , False, False
      .Rows(.SpecialCells(xlBlanks)(1).Row & ":" & .SpecialCells(xlFormulas, xlErrors)(1).Row).EntireRow.Delete
      .Replace "=XXX", "Date/Time Origination", xlWhole, , False, , False, False
   End With
Next i
End Sub
 
Upvote 0
That's a bit of luck :)

Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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