Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting multiple rows within a spreadsheet

Good day all,

I am merging lots of data together from other sheets and i need to
clean it up. i have written a formula so when there is no data that
matches the defined parameters, "delete" is inserted. now i want to
delete the rows that contain "delete" in col "F". how do i do this?

Your help in this matter would be greatly appreciated,

Regards
Jeff Priest
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Deleting multiple rows within a spreadsheet

Try this one

For more example code see
http://www.rondebruin.nl/delete.htm

Sub Example1()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long

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

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1
If IsError(.Cells(Lrow, "F").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf .Cells(Lrow, "F").Value = "delete" Then .Rows(Lrow).Delete
'This will delete each row with the Value "delete" in Column F, case sensitive.

End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jeff" wrote in message om...
Good day all,

I am merging lots of data together from other sheets and i need to
clean it up. i have written a formula so when there is no data that
matches the defined parameters, "delete" is inserted. now i want to
delete the rows that contain "delete" in col "F". how do i do this?

Your help in this matter would be greatly appreciated,

Regards
Jeff Priest



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting multiple rows within a spreadsheet

Dim i as long
Dim lastRow as long
lastrow = Cells(rows.count,"F").End(xlup).row
for i = lastrow to 1 step - 1
if lcase(cells(i,"F").Value) = "delete" then
cells(i,"F").EntireRow.Delete
end if
Next

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
om...
Good day all,

I am merging lots of data together from other sheets and i need to
clean it up. i have written a formula so when there is no data that
matches the defined parameters, "delete" is inserted. now i want to
delete the rows that contain "delete" in col "F". how do i do this?

Your help in this matter would be greatly appreciated,

Regards
Jeff Priest



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting excess rows from a spreadsheet TumbleWeed on Platte Excel Discussion (Misc queries) 1 January 2nd 09 04:50 PM
deleting rows in a huge spreadsheet with subtotals ExcelNovice Excel Discussion (Misc queries) 7 December 13th 06 06:59 PM
Excel 2003; spreadsheet with filtering; deleting rows MHcoTech Excel Worksheet Functions 0 September 6th 06 01:33 AM
Deleting multiple rows through a formula mike_vr Excel Discussion (Misc queries) 1 March 15th 05 01:29 PM
deleting multiple rows Pablo Excel Discussion (Misc queries) 4 January 27th 05 07:18 PM


All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"