Delete & sort macro

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
149
Hi Everyone,

I have a workbook with a page that is an imported, converted PDF. There are numerous "Blank Rows" and then some other
rows that contain (1 of 7) in column A as well as (2/28/2019, 4:50 AM) in Column B. Then other rows that contain (LOTTERY DAILY IMPORT)
in Column A and (file:///C:/Users/dmgpe/Documents/VeriFone/SRNTemp/rad01E09.tmp...) in column B.

I would like to have a macro that deletes those and then resorts the data.
Unfortunately the rows that contain that data that we want to delete shifts everyday.

I attached a Dropbox link below for the file. I HOPE I did that correctly???

Thanks!

https://www.dropbox.com/sh/i18hy7sqbbpmqbl/AAAN5afkoQTNsd1ymMFajC4ka?dl=0

<tbody>
</tbody>
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,436
Office Version
  1. 365
Platform
  1. Windows
Re: Need help with a delete & sort macro

Do you want to delete all rows where col A is blank?
 

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
149
Re: Need help with a delete & sort macro

Hi Fluff,
I didn't spell that out exactly right. It would have to be based on Column E or F since there is data there but A,B,C,D may be blank.

Thanks!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,436
Office Version
  1. 365
Platform
  1. Windows
Re: Need help with a delete & sort macro

That makes it even easier, you can simply use
Code:
Sub Buns1976()
   With Range("F2", Range("F" & Rows.count).End(xlUp))
      .SpecialCells(xlBlanks).EntireRow.Delete
   End With
End Sub
to delete all those rows
 

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
149

ADVERTISEMENT

Re: Need help with a delete & sort macro

Thank You Fluff!

I missed something! In the last Row, in this case Row 381, A381 Contains "Total", B381-D381 are blank and E381:F382 contain SUMS!
I need to get rid of that row as well if that is possible?

Thank You!!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,436
Office Version
  1. 365
Platform
  1. Windows
Re: Need help with a delete & sort macro

How about
Code:
Sub Buns1976()
   With Range("F2", Range("F" & Rows.count).End(xlUp))
      .SpecialCells(xlBlanks).EntireRow.Delete
   End With
   Rows(Range("F" & Rows.count).End(xlUp).Row & ":" & Rows.count).Delete
End Sub
 

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
149
Re: Need help with a delete & sort macro

Fluff,

That did the trick.

Thank you so much!!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,436
Office Version
  1. 365
Platform
  1. Windows
Re: Need help with a delete & sort macro

You're welcome & thanks for the feedback
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,627
Messages
5,838,444
Members
430,548
Latest member
hh_dh2001

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
Top