VBA Loop until no value and if value to copy data

bkeat

New Member
Joined
Jan 2, 2013
Messages
22
Hi

Wonder can anyone help.

I am trying to use a Loop and and IF and another Loop in a macro with vba.

Sheet1: Sheet_Source
Sheet2: Sheet_Display

I have unique ID in Sheet_Source and is sorted smallest to largest and also there is some ID's duplicated so I want to:

STEP 1-
In Sheet_Display Loop until next cell is blank in Column A Sheet_Source and then if there is a value in Sheet_Source Column A (ID)

STEP2-
Then In Sheet_Display Column A (ID) I want to compare the value above it is not equal to it then if it is true in that row

STEP4-
copy that ID into Column A in Sheet_Display and copy cells D from Sheet_Source to Sheet_Display Column C & F-AC in Sheet_Source to Sheet_Display E-AB

STEP3-
But if the ID is equal to the value above in Sheet_Display if there is duplicated IDs (which I have sorted together already in a macro) then loop through however many are there take the highest value from Column D of that group and do step 4.

So I will have one ID per row and it is the highest amount of and no duplicated IDs.


Can anyone help or give pointers if this is the correct approach,

Thanks.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,215,180
Messages
6,123,502
Members
449,100
Latest member
sktz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top