Hi All,
I am working on a large scale project where I receive a report that often comes in different formats each time. One time the columns may be in one order, other times it will be in a different order and I have to import it into a sheet where the order has to be the same every time. I have a very small background in coding in Java, but not so much with VBA. I have uploaded a test document of what I am trying to do in a small scale example. The first worksheet - "Correct Order" is the order that I need to final result to be in. The second worksheet - "Incorrect order" is one example of how the data may come in to me.
Below, I am going to try to write out logically what it is I am trying to accomplish, and I am hoping that someone with far better VBA coding skills than I have can help me with the syntax. Once I get this in small scale, I should be able to replicate in large scale. Thank you in advance for all of your help!
What I am trying to do written out in a logical manner using the attached spreadsheet as a reference:
If (A1 = "Name") - Do nothing and proceed to checking B1 for next condition
If (A1 <> "Name") - Find the column that begins with "Name" and move to Column A
If ("Name" does not exist in any of the column headers)- insert a column in Column A named "Name"
If(B1 = "Date")- Do nothing and proceed to checking C1 for next condition
If (B1 <> "Date") - Find the column that begins with "Date" and move to Column B
If ("Date" does not exist in any of the column headers)- insert a column in Column B named "Date"
And so on through all of the columns.
Again, thank you very much for your help!
Bookmarks