Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Charlie
 
Posts: n/a
Default VBA 'deleting row if a cell in column A is a zero.

Hi People

I'm trying to use the following macro to delete any rows
that have a "0" in all cells that are in Column A -
however whn I run the macro it does change the "0" to the
word "delete" but doesn't delete the rows? Does anyone
know what i'm doning wrong? Thanks!


Sub delete()
Application.ScreenUpdating = False
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "0" Then
Cell.Value = "delete"
End If
Next Cell
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "delete" Then Cell.EntireRow.delete
Next Cell
Range("a1").Select
Application.ScreenUpdating = True
End Sub

  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
check out:
http://www.xldynamic.com/source/xld.Deleting.html

"Charlie" wrote:

Hi People

I'm trying to use the following macro to delete any rows
that have a "0" in all cells that are in Column A -
however whn I run the macro it does change the "0" to the
word "delete" but doesn't delete the rows? Does anyone
know what i'm doning wrong? Thanks!


Sub delete()
Application.ScreenUpdating = False
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "0" Then
Cell.Value = "delete"
End If
Next Cell
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "delete" Then Cell.EntireRow.delete
Next Cell
Range("a1").Select
Application.ScreenUpdating = True
End Sub


  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

In IE that page seems to have a display problem (not in Firefox though :-)).
It only links to other pages so check
http://www.xldynamic.com/source/xld.Deletingv1.html for your code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Frank Kabel" wrote in message
...
Hi
check out:
http://www.xldynamic.com/source/xld.Deleting.html

"Charlie" wrote:

Hi People

I'm trying to use the following macro to delete any rows
that have a "0" in all cells that are in Column A -
however whn I run the macro it does change the "0" to the
word "delete" but doesn't delete the rows? Does anyone
know what i'm doning wrong? Thanks!


Sub delete()
Application.ScreenUpdating = False
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "0" Then
Cell.Value = "delete"
End If
Next Cell
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "delete" Then Cell.EntireRow.delete
Next Cell
Range("a1").Select
Application.ScreenUpdating = True
End Sub




  #4   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi Bob
a converted firefox user. Great!


--
Regards
Frank Kabel
Frankfurt, Germany

"Bob Phillips" schrieb im
Newsbeitrag ...
In IE that page seems to have a display problem (not in Firefox

though :-)).
It only links to other pages so check
http://www.xldynamic.com/source/xld.Deletingv1.html for your code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Frank Kabel" wrote in message
...
Hi
check out:
http://www.xldynamic.com/source/xld.Deleting.html

"Charlie" wrote:

Hi People

I'm trying to use the following macro to delete any rows
that have a "0" in all cells that are in Column A -
however whn I run the macro it does change the "0" to the
word "delete" but doesn't delete the rows? Does anyone
know what i'm doning wrong? Thanks!


Sub delete()
Application.ScreenUpdating = False
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "0" Then
Cell.Value = "delete"
End If
Next Cell
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "delete" Then Cell.EntireRow.delete
Next Cell
Range("a1").Select
Application.ScreenUpdating = True
End Sub





  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

I have so many fewer intrusions with Firefox (at least so far :-))

Bob

"Frank Kabel" wrote in message
...
Hi Bob
a converted firefox user. Great!


--
Regards
Frank Kabel
Frankfurt, Germany

"Bob Phillips" schrieb im
Newsbeitrag ...
In IE that page seems to have a display problem (not in Firefox

though :-)).
It only links to other pages so check
http://www.xldynamic.com/source/xld.Deletingv1.html for your code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Frank Kabel" wrote in message
...
Hi
check out:
http://www.xldynamic.com/source/xld.Deleting.html

"Charlie" wrote:

Hi People

I'm trying to use the following macro to delete any rows
that have a "0" in all cells that are in Column A -
however whn I run the macro it does change the "0" to the
word "delete" but doesn't delete the rows? Does anyone
know what i'm doning wrong? Thanks!


Sub delete()
Application.ScreenUpdating = False
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "0" Then
Cell.Value = "delete"
End If
Next Cell
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "delete" Then Cell.EntireRow.delete
Next Cell
Range("a1").Select
Application.ScreenUpdating = True
End Sub







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
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 08:16 PM
Excel - option to extend function in cell to column kjoshua777 Excel Worksheet Functions 2 November 18th 04 02:08 AM
How do I convert the result of LARGE to the cell (or column) refe. Liam Judd Excel Worksheet Functions 1 November 17th 04 09:44 AM
How can I combine IF, COLUMN, and LARGE formulas in a single cell? Liam Judd Excel Worksheet Functions 1 November 17th 04 08:52 AM
How to populate column with formula based on value in cell Cameron Stewart Excel Worksheet Functions 2 November 2nd 04 02:36 AM


All times are GMT +1. The time now is 10:14 AM.

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"