LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting rows that dont fit criteria

I am new to the Excel macro language, and I am trying to delete entire
rows from 10000+ data points if the last two digits of a 12-digit
number in column A do not end in 00. Here is the macro I have, but it
will only delete the cell in column A. Again, I have an entire
worksheet with corresponding data that needs to be deleted. Thanks

============================

Sub Delete_numbers()

Dim i As Long
Dim number As string
Dim last2 As string

i = 1
number = ActiveCell.FormulaR1C1
For i = 1 to 1000000
number = ActiveCell.FormulaR1C1
If Not number = "" Then
last2 = Right(number, 2)
If Not last2 = "00" Then
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Range("A1").Select
End If
Else
Exit For
End If
Next i
End Sub
 
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
Deleting several rows with given criteria Rechie Excel Discussion (Misc queries) 7 October 20th 09 01:38 PM
deleting rows based on criteria gbpg Excel Programming 7 August 16th 08 05:23 AM
Deleting Rows if certain criteria isnt met Big H Excel Programming 1 September 14th 07 03:10 AM
Deleting rows with a two criteria JOUIOUI Excel Programming 1 June 6th 06 01:09 PM
Deleting rows that dont... Dominique Feteau[_2_] Excel Programming 6 December 24th 04 06:51 AM


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