#1   Report Post  
Posted to microsoft.public.excel.programming
C3 C3 is offline
external usenet poster
 
Posts: 13
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.




  #5   Report Post  
Posted to microsoft.public.excel.programming
art art is offline
external usenet poster
 
Posts: 22
Default 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
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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 02:44 PM.

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

About Us

"It's about Microsoft Excel"