ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to Find & Delete (https://www.excelbanter.com/excel-programming/271821-vba-find-delete.html)

Dave[_16_]

VBA to Find & Delete
 
would anybody be able to give me code to do the following;

i have a list of destinations A-Z, with 2 columns of data
in columns B & C

i would like to find specific destination names,
forexample 'France,Paris', and then delete the whole row
which that destination is on. I would then like to repeat
this several times

thanks in advance for any help
Dave

Tim Zych[_2_]

VBA to Find & Delete
 
I have some sample code to do this at www.rubbershoe.com/deleterows.htm

"Dave" wrote in message
...
would anybody be able to give me code to do the following;

i have a list of destinations A-Z, with 2 columns of data
in columns B & C

i would like to find specific destination names,
forexample 'France,Paris', and then delete the whole row
which that destination is on. I would then like to repeat
this several times

thanks in advance for any help
Dave




Don Guillett[_4_]

VBA to Find & Delete
 
a for/each loop should do it

for each c in selection
if c.value="France,Paris" then
next

--
Don Guillett
SalesAid Software
Granite Shoals, TX

"Dave" wrote in message
...
would anybody be able to give me code to do the following;

i have a list of destinations A-Z, with 2 columns of data
in columns B & C

i would like to find specific destination names,
forexample 'France,Paris', and then delete the whole row
which that destination is on. I would then like to repeat
this several times

thanks in advance for any help
Dave




Dave[_16_]

VBA to Find & Delete
 
Tim,

this worked for 1 value, how would I make this work for
say 3 different values, I tried adding the following line
for each one but the macro failed

Sub FindNDelete1()
Application.ScreenUpdating = False
Dim lngRow As Long, lngLastRow As Long
lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For lngRow = lngLastRow To 1 Step -1
If Cells(lngRow, "A").Value = "Germany,Munich" Then
Cells(lngRow, "A").EntireRow.Delete
If Cells(lngRow, "A").Value = "France,Paris" Then
Cells(lngRow, "A").EntireRow.Delete
End If
Next lngRow
Application.ScreenUpdating = True
End Sub

regards
Dave
-----Original Message-----
I have some sample code to do this at

www.rubbershoe.com/deleterows.htm

"Dave" wrote in message
...
would anybody be able to give me code to do the

following;

i have a list of destinations A-Z, with 2 columns of

data
in columns B & C

i would like to find specific destination names,
forexample 'France,Paris', and then delete the whole row
which that destination is on. I would then like to

repeat
this several times

thanks in advance for any help
Dave



.



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

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