Delete & sort macro

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
194
Office Version
  1. 365
Platform
  1. Windows
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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Re: Need help with a delete & sort macro

Do you want to delete all rows where col A is blank?
 
Upvote 0
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!
 
Upvote 0
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
 
Upvote 0
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!!
 
Upvote 0
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
 
Upvote 0
Re: Need help with a delete & sort macro

Fluff,

That did the trick.

Thank you so much!!
 
Upvote 0
Re: Need help with a delete & sort macro

You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,218,809
Messages
6,144,607
Members
450,559
Latest member
kwenda farai

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