Forum Discussion
GabrielSzep
Jul 20, 2022Copper Contributor
VBA code to copy certain data
Hello, I am reaching out for help on a project that I am currently working on. I cannot disclose the project to you, however, hopefully I can explain it well enough that you will be able to help me. I am building a report off of imported survey data from Qualtrics. My report is built, however, I need help cleaning up the imported data so that my formulas will work. At the beginning of the survey, it asks the user for their first and last name as well as their email address. At the end of the survey, it asks the user if they would like to take it again or to end the survey. If the user chooses to take the survey again, the survey keeps their personal information from before and continues to ask the main questions again. They have the option to take it up to 6 times. When this gets imported to excel, each user takes up one row. I am trying to separate each time the user takes the survey on the excel sheet. I am trying to build a macro in VBA, however I am not as familiar with VBA as I would like to be. I think I have the process down I just need help writing the code.
The Macro must start at A2, reads the row until it gets to a cell that says either "Yes" or "End Survey". If the cell reads "yes", I need the code to copy the remainder of that row and insert it in a new row right below it starting in column D. Then it must continue to read the row that was just inserted until it comes across either "Yes" or "End Survey" again. This process must continue until you come across a cell that says "End Survey". When the cell reads "End Survey", the code should move down to the next row (which then should be the next user) and start the process all over again. There are 6 columns throughout the data that read either "Yes" or "End Survey" so I cannot give an accurate location on where those columns of cells will be. I should also add that I am thinking of putting all of this code into a command button, so that all I have to do is click the button and the code will format the data for me.
I know this is a lot but I'd really appreciate it if someone could help me on this. If you have any questions please comment and I will get back to you shortly. If you would like me to generate some dummy data that you could work with, I can do that as well. Thank you and have a great day.
No RepliesBe the first to reply