Advice on CSV import, Filter, and row delete

DiscoSte

New Member
Joined
Feb 17, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi Folks

I have a large csv, and I would like to run a Macro that imports it (say from C:\Test\Test.csv), then allows the user to specify a string via Input Box (or otherwise), and any row not containing that string (in a specific column "G") gets deleted/removed.
I'm having a bit of a nightmare trying to do it with filters, as that leaves the data in there, and I have 6/7 subsequent macros, that seemingly won't play ball if it's filtered.

Any help/advice would be greatly appreciated.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
6,190
Office Version
  1. 365
Platform
  1. Windows
Use Power Query called Get and Transform Data in your version of Excel. Found on the Data Tab.

Bring your csv file into PQ. When you filter in PQ, it removes the line of data -- not just hides it as in Native Excel. Close and Load the file back to Excel and run your needed macros.
 
Solution

DiscoSte

New Member
Joined
Feb 17, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Thank you Alan, very much appreciated.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,685
Messages
5,637,798
Members
416,983
Latest member
LessThanAverageUser

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
Top