I'm trying to see if I can use a macro to search for a list of keywords within a whole workbook and then copy the entire row that contains the keyword, label it with the name of the sheet it came out of, then paste it into a new workbook or worksheet (whichever is easier).
To help with explaining, the workbook I'm pulling from is a list of different shipping ports (a different port in each sheet with the port name as the sheet name) in Australia and the freight ships that are at port or expected within that week (report comes in weekly). I need to pull the rows that contain the products my company deals with, as well as the destinations it's going to or coming from. So the keywords list will be something like "Cement, Iron, Aluminum, South Africa, China, India". I would need the macro to pull the rows in the whole workbook that have any of the keyboards. Put them in a new sheet or workbook and automatically label which port (or which sheet) the row came from. The problem is that in each of the sheets individually, the columns are not always labeled the same way. It could be "Vessel Name, Cargo, Weight of Cargo, Original Port, Shipping Company" (Columns A,B,C,D respectively) and the next sheet/port could be "Cargo, Vessel Name, Time of Arrival". Some sheets might have columns that others don't.
So I guess I'm looking for a way that will tell VBA to just search in the whole workbook, with no reference to any columns or rows in particular. Just a label for which sheet it came from. Any ideas?
Bookmarks