I wonder if anyone can help with the below, please.
I'm trying to write a macro that will run from a button that looks along a specific row based on the selected cell "A2", finds the text "y" in a cell along that row, in the first column. Then copies cells A2,B2,C2,D2,E2 from this worksheet into another worksheet with the same name as the column heading on sheet1, that had the text "y". Then loops to find all the remaining "y" texts in the remaining columns?
example: highlighted cell is A2. vba looks along line 2, locates the first "y". The column is headed "sales". It then copies cells A2,B2,C2,D2,E2 and pastes the data into the next available line in worksheet "sales". It then looks for the next "y" in the next column ie: headed "Purchasing" on row 2 and copies the same cells (A2,B2,C2,D2,E2) to the worksheet called "Purchasing", and so on until there are no more "y" texts.
As you can see in the code I have got something to work but it copies the whole row and I can not get it to loop to the next column on that row.
I hope the above makes sense to you boffins?
Thanks Pete
PS: I'm new to vba so go easy on me ...lol
I'm trying to write a macro that will run from a button that looks along a specific row based on the selected cell "A2", finds the text "y" in a cell along that row, in the first column. Then copies cells A2,B2,C2,D2,E2 from this worksheet into another worksheet with the same name as the column heading on sheet1, that had the text "y". Then loops to find all the remaining "y" texts in the remaining columns?
example: highlighted cell is A2. vba looks along line 2, locates the first "y". The column is headed "sales". It then copies cells A2,B2,C2,D2,E2 and pastes the data into the next available line in worksheet "sales". It then looks for the next "y" in the next column ie: headed "Purchasing" on row 2 and copies the same cells (A2,B2,C2,D2,E2) to the worksheet called "Purchasing", and so on until there are no more "y" texts.
As you can see in the code I have got something to work but it copies the whole row and I can not get it to loop to the next column on that row.
I hope the above makes sense to you boffins?
Thanks Pete
PS: I'm new to vba so go easy on me ...lol