Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default delete row based on column value??


I would like to delete a row if the value in a column is zero. How
could I do that with a simple macro? I am not that savvy when it comes
to Excel.

Thanks


--
elkins
------------------------------------------------------------------------
elkins's Profile: http://www.excelforum.com/member.php...o&userid=27707
View this thread: http://www.excelforum.com/showthread...hreadid=473963

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default delete row based on column value??

Maybe apply Data|Filter|autofilter
show that value and delete the visible rows.
and show all the data

Recording a macro when you do it manually will give you the code.

elkins wrote:

I would like to delete a row if the value in a column is zero. How
could I do that with a simple macro? I am not that savvy when it comes
to Excel.

Thanks

--
elkins
------------------------------------------------------------------------
elkins's Profile: http://www.excelforum.com/member.php...o&userid=27707
View this thread: http://www.excelforum.com/showthread...hreadid=473963


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default delete row based on column value??

What about this:

'_________________________________________________ __________

Public Sub deleteEmptyRow()

For Each rw In Selection.Cells

If rw.Cells(1, 1) = "" Then
rw.Cells(1, 1).EntireRow.Delete
End If
Next

End Sub

'_________________________________________________ __________

Of course that requires the "test" column to be highlighted. It's best to
only highlight a single column on the rows that you want to test (ie not the
whole column). You could also replace:

For Each rw In Selection.Cells

with

For Each rw In range("A1:A100")

or some other range as needed. If you want to test for a particular value
just put that value between the " ".

- Rm


"elkins" wrote:


I would like to delete a row if the value in a column is zero. How
could I do that with a simple macro? I am not that savvy when it comes
to Excel.

Thanks


--
elkins
------------------------------------------------------------------------
elkins's Profile: http://www.excelforum.com/member.php...o&userid=27707
View this thread: http://www.excelforum.com/showthread...hreadid=473963


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
Copy column header to next column, delete & delete every nth colum genehunter New Users to Excel 1 June 2nd 09 03:57 PM
Code help, delete rows based on column criteria Stout Excel Discussion (Misc queries) 2 March 20th 07 01:17 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
delete based on flow23 Excel Discussion (Misc queries) 1 July 3rd 06 12:23 PM
Column Delete based on String scott Excel Programming 19 February 22nd 05 06:53 PM


All times are GMT +1. The time now is 01:49 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"