close

I have a spread sheet with data in A:A to G:G

I want a macro that will check the value in G and if its less than 3 to
delete that entire row and then move on to the next row and do the same--
Steve M
------------------------------------------------------------------------
Steve M's Profile: www.excelforum.com/member.php...oamp;userid=32520
View this thread: www.excelforum.com/showthread...hreadid=534535something like
for i = cells(rows.count,quot;aquot;).end(xlup).row to 2 step -1
if cells(i,quot;aquot;)lt;3 then rows(i).delete
next i

--
Don Guillett
SalesAid Software

quot;Steve Mquot; gt; wrote in
message ...
gt;
gt; I have a spread sheet with data in A:A to G:G
gt;
gt; I want a macro that will check the value in G and if its less than 3 to
gt; delete that entire row and then move on to the next row and do the same
gt;
gt;
gt; --
gt; Steve M
gt; ------------------------------------------------------------------------
gt; Steve M's Profile:
gt; www.excelforum.com/member.php...oamp;userid=32520
gt; View this thread: www.excelforum.com/showthread...hreadid=534535
gt;
Insert a new column adjacent to your data and use it to insert row #s for all
your data. Now sort on column G so that all the rows less than 3 are in a
contiguous range. Delete them. Now sort on the rows numbers to restore your
data to its original order

quot;Steve Mquot; wrote:

gt;
gt; I have a spread sheet with data in A:A to G:G
gt;
gt; I want a macro that will check the value in G and if its less than 3 to
gt; delete that entire row and then move on to the next row and do the same
gt;
gt;
gt; --
gt; Steve M
gt; ------------------------------------------------------------------------
gt; Steve M's Profile: www.excelforum.com/member.php...oamp;userid=32520
gt; View this thread: www.excelforum.com/showthread...hreadid=534535
gt;
gt;

On Thu, 20 Apr 2006 08:02:35 -0500, Steve M
gt; wrote:

gt;
gt;I have a spread sheet with data in A:A to G:G
gt;
gt;I want a macro that will check the value in G and if its less than 3 to
gt;delete that entire row and then move on to the next row and do the same

One way.

First name the first cell in column G of your data as quot;StartRowquot;

I'm also assuming that there is something in all the cells in column
G. If not you'll need to change the lrows variable to something like
lrows=Range(Range(quot;Startrowquot;),Range(quot;G65536quot;).End( xlUp)).Rows.CountSub DeleteGRowValue3()
Dim lRows As Long, x As Long
lRows=Range(Range(quot;Startrowquot;),Range(quot;Startrowquot;).En d(xlDown)).Rows.Count

For x = lRows To 1 Step -1
If Range(quot;startrowquot;).Offset(x - 1, 0) lt; 3 Then
Range(quot;startrowquot;).Offset(x - 1, 0).EntireRow.Delete
End If
Next

End Sub__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________

change quot;aquot; to quot;gquot;

--
Don Guillett
SalesAid Software

quot;Don Guillettquot; gt; wrote in message
...
gt; something like
gt; for i = cells(rows.count,quot;aquot;).end(xlup).row to 2 step -1
gt; if cells(i,quot;aquot;)lt;3 then rows(i).delete
gt; next i
gt;
gt; --
gt; Don Guillett
gt; SalesAid Software
gt;
gt; quot;Steve Mquot; gt; wrote in
gt; message ...
gt;gt;
gt;gt; I have a spread sheet with data in A:A to G:G
gt;gt;
gt;gt; I want a macro that will check the value in G and if its less than 3 to
gt;gt; delete that entire row and then move on to the next row and do the same
gt;gt;
gt;gt;
gt;gt; --
gt;gt; Steve M
gt;gt; ------------------------------------------------------------------------
gt;gt; Steve M's Profile:
gt;gt; www.excelforum.com/member.php...oamp;userid=32520
gt;gt; View this thread:
gt;gt; www.excelforum.com/showthread...hreadid=534535
gt;gt;
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()