I have run into an issue with some logic in VBA which I have found in my experience very tricky to figure out, I will attempt to explain it below.
I have 4 columns in my worksheet, structured as follows
| A | | B | | C | | D |
|First Name| |Last Name| |Type| |Text|
I am in search of some VBA which can effectively scan the First Name column, once it encounters a blank, it initiates the following logic
- Look in the Type (C) Column
- If it encounters text in the type column that says Journal then check the cell located in the same row in the Text (D) column
- Take the free text in the text column, put it into an array.
- Use the text in the array and scan the First Name column for matching text entries, if it finds a match then take the matching text in the Text column and paste it into the First Name column. Do this until the array runs out.
- Restart step 4 for the Last Name column
- Loop back to step 1
NOTES: The text in the Text column is a free text extract from a third party application (SAP), therefore I am running off the assumption that if it contains a First Name or Last Name, it can match it with the entries already located in the First Name and Last Name column
I have been looking everywhere for syntax which can do this efficiently but I am stuck with writing the logic for this and need some advice from the community, any ideas?
UPDATE: An example of the data would be like this
| A | | B | | C | | D |
| First Name | | Last Name | | Type | | Text |
| Michael | | Jackson | | WE | | SAP CATS |
| | | | | SS | | CATS O/H Michael Jackson|