ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro (https://www.excelbanter.com/excel-programming/294683-macro.html)

C3

macro
 
HI!

How to make a macro who will find some value (etc. 0) in a specific column
(etc. column B), and erase entire row.

Thanks.



Frank Kabel

macro
 
Hi
try the following macro
Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).row
For RowNdx = LastRow To 1 Step -1
with Cells(RowNdx, "B")
if .value = 0 then
Rows(RowNdx).Delete
End If
end with
Next RowNdx
Application.ScreenUpdating = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


C3 wrote:
HI!

How to make a macro who will find some value (etc. 0) in a specific
column (etc. column B), and erase entire row.

Thanks.


Don Guillett[_4_]

macro
 
something like this to check column A
Sub delzeros()
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(i, 1) = 0 Then Rows(i).Delete
Next
End Sub
--
Don Guillett
SalesAid Software

"C3" wrote in message
...
HI!

How to make a macro who will find some value (etc. 0) in a specific column
(etc. column B), and erase entire row.

Thanks.





Bob Phillips[_6_]

macro
 
If there is just one or no occurrence, use the Find method. Add FindNext if
multiple occurrences.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"C3" wrote in message
...
HI!

How to make a macro who will find some value (etc. 0) in a specific column
(etc. column B), and erase entire row.

Thanks.





art

macro
 
Keep in mind that depending upon what values are allowed in your spreadsheet, you might need to watch out for empty cells and cells with the value of FALSE. I believe that these will also evaluate to 0. If necessary you can use the IsEmpty function to test for empty cells. Also, you can use the Str function to convert your cell to a string. This should help to identify cells that are FALSE

Art


All times are GMT +1. The time now is 04:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com