Delete consecutive rows and rows with only forward slash ////

nevsky092315

New Member
Joined
May 3, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Greetings All, I am looking for some help, I want to delete below conditions in column A of the worksheet.
  • If 3 consecutive rows are empty, need to delete those rows.
  • If any row has only "/////" character, need to delete those rows.
Thanks in advance.
 

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
Adding examples, please if someone help, that will be great. Need to delete below conditions in column A of a worksheet.
  • If 3 consecutive rows are empty, need to delete those rows.
  • If any row has only "/" character, without any other text, need to delete those rows.

Below is how it is present:

1610262002422.png


Below is the expected output.

1610262096315.png


Appreciate any help. THANK YOU.
 
Upvote 0
VBA Code:
Sub v()
Dim rng As Range, a As Range, c&
Set rng = Range("A1:A" & Cells(Rows.Count, 1).End(3).Row).SpecialCells(xlCellTypeBlanks)
Application.ScreenUpdating = False
For Each a In rng.Areas
    If a.Count > 2 Then a.Resize(a.Count - a.Count Mod 3).EntireRow.Delete
Next
Set rng = Range("A1:A" & Cells(Rows.Count, 1).End(3).Row)
For c = rng.Count To 1 Step -1
    If rng(c) <> "" And Len(Replace(rng(c), "/", "")) = 0 Then rng(c).EntireRow.Delete
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,614
Members
449,039
Latest member
Mbone Mathonsi

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