Link to home
Start Free TrialLog in
Avatar of Ray
RayFlag for United States of America

asked on

Have Excel VBA move data over 1 or 2 columns based on values - Ultimately get data aligned

I've attached a sample workbook with data like I have and what I want.  I need VBA code to transfer data accordingly.

I'm pretty sure I need a loop that will run through the first column (A) and find each row that is NOT "delivery".  If not "delivery" then move col A & B over to Col C & D.  Then do the same concept on Column C where each row that is not "beverage".  If not "beverage", then move col C&D to E&F.  

I know it likely sounds confusing, but I'm fairly certain when you see the sample workbook it will be crystal clear.

Thanks in advance.
Sample-loop-file.xlsm
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ray

ASKER

Ok, it seems as though all of them worked on my sample workbook just fine.  Ultimately, as is typical, the end project did require some adaptation and Saurabh's solution leant itself to adapting quite well and it was first.  I will also freely admit that I've 'followed' Saurabh for some time and was therefore slightly biased toward using his solution.  Therefore, most points to Saurabh and partial credit for Martin and Hakan.

Excellent work by all of you and speedy responses to my hastily thrown together sample (was about to leave work for the weekend).

Thank you all!
Thanks Ray.. Glad it worked for you.. :-)

Saurabh...