Help with rest of forumla - Delete rows based on criteria

M

Mariann

I am extracting information from a named range of information from one sheet
to another based on matching sets of data. That is working great but I'm
wondering if there is a formula that will expand this to delete rows when the
salary is returned as 0.00. Here is what I have so far:

=SUMIF(SSNLLS,SSNLLBL,salary)
(if the social on one sheet matches social on the other, return the salary
information)

Does anyone know of an easy formula to add to this or would I have to write
a macro to delete those rows that return 0.00?

Thanks so much!
Mariann
 
E

Eduardo

Hi,
Here you have a macro written by Ron de Bruin, just check the value to be
deleted I change it to 0.00

If this helps please click yes, thanks

Sub Loop_Example()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

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

'We use the ActiveSheet but you can replace this with
'Sheets("MySheet")if you want
With ActiveSheet

'We select the sheet so we can change the window view
.Select

'If you are in Page Break Preview Or Page Layout view go
'back to normal view, we do this for speed
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

'Turn off Page Breaks, we do this for speed
.DisplayPageBreaks = False

'Set the first and last row to loop through
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row

'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1

'We check the values in the A column in this example
With .Cells(Lrow, "A")

If Not IsError(.Value) Then

If .Value = "0.00" Then .EntireRow.Delete
'This will delete each row with the Value "0"
'in Column A, case sensitive.

End If

End With

Next Lrow

End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub
 
P

Pete_UK

A formula can't be used to delete a row, so you would need a macro to
do that.

An alternative approach (manually) is to apply a filter to the salary
column and select 0. Then you can highlight the visible cells and Edit
| Delete Row, then select All from the filter pull-down.

Hope this helps.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top