ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Deletion (https://www.excelbanter.com/excel-programming/365475-conditional-deletion.html)

Seeking help[_3_]

Conditional Deletion
 

Hi there,

could you provide me with a code that allows me to search User I
column for any numbers that start with "000XXXXX" and deleting th
whole row that fulfill this condition?

Thanks!!:

--
Seeking hel
-----------------------------------------------------------------------
Seeking help's Profile: http://www.excelforum.com/member.php...fo&userid=3565
View this thread: http://www.excelforum.com/showthread.php?threadid=55590


Kaak[_65_]

Conditional Deletion
 

Sub Remove()

Dim i, iOffset As Long

iOffset = Range("A" & Rows.Count).End(xlUp).Row - 1

For i = iOffset To 0 Step -1

If Range("A1").Offset(iOffset, 0).Value = "000XXXXX" The
Rows(iOffset + 1).Delete

Next i

End Su

--
Kaa
-----------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...nfo&userid=751
View this thread: http://www.excelforum.com/showthread.php?threadid=55590


Seeking help[_4_]

Conditional Deletion
 

Thanks Kaak!!:)
And sorry,I make a mistake in my question, i have to delete numbers
that start off with "000XXXXX" instead.Didn't phrase my question
correctly.

Example is like:
00012345 <--to be deleted
00020000 <--to be deleted
21000000 <--not to be deleted

**X represent numbers from 0-9.


--
Seeking help
------------------------------------------------------------------------
Seeking help's Profile: http://www.excelforum.com/member.php...o&userid=35658
View this thread: http://www.excelforum.com/showthread...hreadid=555904


Kaak[_71_]

Conditional Deletion
 

If Mid(Range("A1").Offset(iOffset, 0).Value,1,3) = "000" Then
Rows(iOffset + 1).Delete


--
Kaak
------------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...fo&userid=7513
View this thread: http://www.excelforum.com/showthread...hreadid=555904



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com