VBA help !!!

D

Dushyant Rajput

Hi,

my data contains numeric value such as:

9121693
9147952
11912447500
12012461596

I want to delete the value starting with 918 , 011 etc...
Is it poss via macro? any help would be highly app


Thanks
Dush
 
D

Don Guillett

a looping macro
for each c in selection
if left(c,3)=918 or left(c,3)=011 then c.entirerow.delete
next c
 
D

Dushyant Rajput

its working but I have to run macro again and again for different numeric
value . I have to delete the rows starting with the numbers( 918, 1800, 011,
1888, etc.. 11 more values) . Is it possible to delete the rows in one go
for all the values.

Thanks for all the help
Dush
 
K

kounoike

Then give this a try.

Sub delrowtest()
Dim crt, v
Dim fs As Long, last As Long, cl As Long
Dim i
crt = Array("918", "1800", "011", "1888") '<<==Change here
fs = Selection(1).Row
cl = Selection(1).Column
last = Selection(Selection.Count).Row
For i = last To fs Step -1
v = Application.Match(1, Application.Search(crt, Cells(i, cl)),
0)
If Not IsError(v) Then
Rows(i).Delete
End If
Next
End Sub

keizi
 
Top