Delete part of cell content

navex

New Member
Joined
Sep 29, 2011
Messages
2
Hi All.

I am trying to come up with a macro that would remove part of a cells data.

Example: each row of data is help in column A

"http://www.aena-aeropuertos.es/csee/Satellite/infovuelos/en/Details.html?accion=detalle&company_code=FR&dia=20110930&hora_prev=2011-09-30+19%3A15&ncia=FR&numBusqueda=FR5574&nvuelo=5574&ordenacionBack=hprevisto&originBack=ALC&originBusqueda=ALC&pagBack=5&strVuelo=FR5574"
"http://www.aena-aeropuertos.es/csee/Satellite/infovuelos/en/Details.html?accion=detalle&company_code=FR&dia=20110930&hora_prev=2011-09-30+19%3A25&ncia=FR&numBusqueda=FR9056&nvuelo=9056&ordenacionBack=hprevisto&originBack=ALC&originBusqueda=ALC&pagBack=5&strVuelo=FR9056"
"http://www.aena-aeropuertos.es/csee/Satellite/infovuelos/en/Details.html?accion=detalle&company_code=BE&dia=20110930&hora_prev=2011-09-30+19%3A35&ncia=BE&numBusqueda=BE1716&nvuelo=1716&ordenacionBack=hprevisto&originBack=ALC&originBusqueda=ALC&pagBack=5&strVuelo=BE1716"

At the end of each row of data there is "strVuelo=" followed by variable text. If the variable text that follows "strVuelo=" contains "FR" do not delete the row.

Can anyone help with a solution.

Many thanks in advance.

NaveX
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> Keep_FR_Rows()<br>    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN><br>    <SPAN style="color:#00007F">For</SPAN> i = Range("A" & Rows.Count).End(xlUp).Row <SPAN style="color:#00007F">To</SPAN> 1 <SPAN style="color:#00007F">Step</SPAN> -1<br>        <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> Range("A" & i).Value <SPAN style="color:#00007F">Like</SPAN> "*strVuelo=FR*" <SPAN style="color:#00007F">Then</SPAN> Rows(i).Delete<br>    <SPAN style="color:#00007F">Next</SPAN> i<br>    Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Last edited:
Upvote 0
Hi AlphaFrog,

Many thanks for your reply, and of course it worked as required.

I have one more question if I may, The file I am working on is in CSV format, is there a way to run your macro from the CSV file.


Again many thanks for your time.

Regards

NaveX
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top