Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 09-29-2016, 12:17 PM
NoSparks NoSparks is offline count and delete row Windows 7 64bit count and delete row Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

I believe this does what you're asking, although it doesn't match your after file.
Code:
Sub tomlam()
' remove rows with blank "C" and limit to 15

    Dim lr As Long
    Dim r As Long
    Dim i As Integer

With Application
    .ScreenUpdating = False
    .Calculation = xlCalculationManual
End With

'delete rows where C is blank
Range("C1", Cells(Rows.Count, "C").End(xlUp)).SpecialCells(xlBlanks).EntireRow.Delete

'limit to 15
lr = Cells(Rows.Count, "C").End(xlUp).Row
For r = lr To 2 Step -1
    If Cells(r, "C").Value = "total export" Then
        i = 0
    Else
        i = i + 1
    End If
    If i > 15 Then Rows(r).Delete
Next r

With Application
    .ScreenUpdating = True
    .Calculation = xlCalculationAutomatic
End With

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
count and delete row Getting the Count formula to count all rows Jennifer Murphy Word Tables 11 08-23-2016 09:37 PM
How to Delete the same watermark that are in 300 slides. I cant dare to manually delete. yeshwanthkota111 PowerPoint 0 09-05-2015 10:03 AM
count and delete row Delete starting number *) and delete Unneeded data in series frustrated teacher Word VBA 5 12-07-2014 06:53 PM
Delete option greyed out when trying to delete row 1 tpcervelo Excel 2 11-15-2011 06:48 AM
delete email message via blackberry and have it delete on my pop3 and my outlook Iamthestorm Outlook 2 10-28-2010 12:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft