Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting excess rows from a spreadsheet | Excel Discussion (Misc queries) | |||
deleting rows in a huge spreadsheet with subtotals | Excel Discussion (Misc queries) | |||
Excel 2003; spreadsheet with filtering; deleting rows | Excel Worksheet Functions | |||
Deleting multiple rows through a formula | Excel Discussion (Misc queries) | |||
deleting multiple rows | Excel Discussion (Misc queries) |