Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11
Default Macro needed to identify value and delete row if value below targe

I need a macro that will locate a numeric value in column J only, and if that
value is less than 15, the entire row on which that value is located will be
deleted. Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,934
Default Macro needed to identify value and delete row if value below targe

Give this macro a try...

Sub RemoveRowsLessThan15()
Dim X As Long
With Worksheets("Sheet1")
For X = .UsedRange.Rows.Count To 1 Step -1
If IsNumeric(.Cells(X, "J").Value) Then
If .Cells(X, "J").Value < 15 Then .Rows(X).Delete
End If
Next
End With
End Sub

--
Rick (MVP - Excel)


"Pyrotoy" wrote in message
...
I need a macro that will locate a numeric value in column J only, and if
that
value is less than 15, the entire row on which that value is located will
be
deleted. Thank you.


  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11
Default Macro needed to identify value and delete row if value below t

Rick: Works perfectly. Thanks for the fast response. Best wishes, Scott

"Rick Rothstein" wrote:

Give this macro a try...

Sub RemoveRowsLessThan15()
Dim X As Long
With Worksheets("Sheet1")
For X = .UsedRange.Rows.Count To 1 Step -1
If IsNumeric(.Cells(X, "J").Value) Then
If .Cells(X, "J").Value < 15 Then .Rows(X).Delete
End If
Next
End With
End Sub

--
Rick (MVP - Excel)


"Pyrotoy" wrote in message
...
I need a macro that will locate a numeric value in column J only, and if
that
value is less than 15, the entire row on which that value is located will
be
deleted. Thank you.



  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11,058
Default Macro needed to identify value and delete row if value below targe

Sub killsmall()
n = Cells(Rows.Count, "J").End(xlUp).Row
For j = n To 1 Step -1
If Cells(j, "J").Value < 15 Then
Cells(j, "J").EntireRow.Delete
End If
Next
End Sub

--
Gary''s Student - gsnu200819
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
How do I identify matching rows of data and delete them both? WMark Excel Discussion (Misc queries) 4 October 17th 08 01:43 PM
Need to identify active worksheet in macro MLK Excel Worksheet Functions 1 March 13th 07 04:29 PM
Identify the duplicate and delete with details in excel mat Excel Discussion (Misc queries) 0 November 15th 06 09:03 PM
How do I build a Macro that can identify wooksheet names peter147 Excel Discussion (Misc queries) 4 May 22nd 05 04:26 PM
How can I have excel search and add multiple cells to find a targe Blakepro Excel Discussion (Misc queries) 1 April 1st 05 02:37 AM


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

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"