VBA help !!!

  • Thread starter Thread starter Dushyant Rajput
  • Start date Start date
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
 
a looping macro
for each c in selection
if left(c,3)=918 or left(c,3)=011 then c.entirerow.delete
next c
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top