PC Review


Reply
Thread Tools Rate Thread

Delete row if value is zero

 
 
KWhamill
Guest
Posts: n/a
 
      21st Jul 2008
I'm trying to create an if statement that will delete entire rows where the
value in Column N is less than .01 or efectively zero for my purposes. The
little bit i've figured out will delete the row but only if the whole row is
blank. If any one can help me all the better.
Thank you,
Karl
 
Reply With Quote
 
 
 
 
Susan
Guest
Posts: n/a
 
      21st Jul 2008
======================
Option Explicit

Sub step_backwards()


Dim myLastRow As Long
Dim r As Long
Dim c As Range


myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row


For r = myLastRow To 1 Step -1
Set c = ActiveSheet.Range("a" & r)
If c.Value = "" Then
c.EntireRow.Delete
End If
Next r


End Sub
=========================
it looks for blanks in column A. change that if you need to.
hope it helps

susan




On Jul 21, 10:05*am, KWhamill <KWham...@discussions.microsoft.com>
wrote:
> I'm trying to create an if statement that will delete entire rows where the
> value in Column N is less than .01 or efectively zero for my purposes. The
> little bit i've figured out will delete the row but only if the whole rowis
> blank. If any one can help me all the better.
> Thank you,
> Karl


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      21st Jul 2008
ALWAYS post your efforts for comments

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"KWhamill" <(E-Mail Removed)> wrote in message
news:93699F6D-962F-46EA-AB30-(E-Mail Removed)...
> I'm trying to create an if statement that will delete entire rows where
> the
> value in Column N is less than .01 or efectively zero for my purposes. The
> little bit i've figured out will delete the row but only if the whole row
> is
> blank. If any one can help me all the better.
> Thank you,
> Karl


 
Reply With Quote
 
KWhamill
Guest
Posts: n/a
 
      21st Jul 2008
Thank you that was great Now i see what i was doing wrong.
R,
Karl

"Susan" wrote:

> ======================
> Option Explicit
>
> Sub step_backwards()
>
>
> Dim myLastRow As Long
> Dim r As Long
> Dim c As Range
>
>
> myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row
>
>
> For r = myLastRow To 1 Step -1
> Set c = ActiveSheet.Range("a" & r)
> If c.Value = "" Then
> c.EntireRow.Delete
> End If
> Next r
>
>
> End Sub
> =========================
> it looks for blanks in column A. change that if you need to.
> hope it helps
>
> susan
>
>
>
>
> On Jul 21, 10:05 am, KWhamill <KWham...@discussions.microsoft.com>
> wrote:
> > I'm trying to create an if statement that will delete entire rows where the
> > value in Column N is less than .01 or efectively zero for my purposes. The
> > little bit i've figured out will delete the row but only if the whole row is
> > blank. If any one can help me all the better.
> > Thank you,
> > Karl

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete data in a linked Excel sheet using Access code or seql delete Rocky Microsoft Access External Data 9 26th Jun 2005 12:42 AM
Re: Macro to delete sheets and saves remaining file does not properly delete module gazornenplat Microsoft Excel Programming 0 22nd Jun 2005 01:12 AM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Microsoft Excel Programming 7 21st Jun 2005 05:16 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette Microsoft Excel Programming 2 21st Sep 2004 02:40 PM
Re: When I highlight a sentence to delete, Word won't let me. I have to backspace. How can I deleted selected text with my delete key? Bill Foley Microsoft Word Document Management 1 4th Feb 2004 11:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:08 PM.