New to VBA and am trying to essentially lookup column headers in on sheet to another and if match copy data over...
I was told that I can store my headers in a string array then loop through and compare the headers to my array to see if they match.
ie: For each c In
Sheet1.Range("A1:BA1").offset(rownumber -1)
But I'm not sure what that means? How do I store my headers in a string array? Sorry if this is a super basic question. I have googled it and not found anything explaining how to do this or what it means.
My Project: research data on sheet1. If there is an issue I want to click a button that will copy only the matching column data to a new row in a Specified sheet. From there the data will be reviewed and then another button to export the data to an MS SQL table.
ie:
Sheet1
A B C D E
ID CUR Region Amount Y/N
1 USD NA $54 Y
Sheet2
A B C D E
Region CUR Amount Type Misc
So if Column E = Y then copy all the relevant data in that row to a new sheet:
Sheet2 (output)
A B C D E
Region CUR Amount Type Misc
NA USD $54 Null Null
Sheet2 has columns not in Sheet1 and vice versa... Also the order of the columns are not the same in each sheet. The real sheets are huge with many columns and the row count will change everytime I refresh my data. I need this to loop until Col A in Sheet1 is null.