Delete & sort macro

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
138
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:

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,650
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
138
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
46,650
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
138

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
46,650
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
138
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
46,650
Office Version
  1. 365
Platform
  1. Windows
Re: Need help with a delete & sort macro

You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,109,522
Messages
5,529,330
Members
409,863
Latest member
stacy09
Top