VBA Code to Work down a list, calc a result, add result to bottom of new list

JamesGilchrist

New Member
Joined
Apr 12, 2011
Messages
13
Hi All,

Any help here would be appreciated greatly.

CODE SEQUENCE
1 Copy Item A from List A
2 Paste flat to B2
3 Recalculate the result to update C2
4 Copy range B2:C2
5 Paste flat to bottom of List B
6 Goto next cell on List A
Repeat steps 1-6
Stop at bottom of List A

ABCDE
1INPUTSCALCULATIONOUTPUTS
2List AItem AResult AList B
3Item AItem AResult A
4Item B
5Item C
6Item D
7
8

<tbody>
</tbody>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Re: "3 Recalculate the result to update C2"???????
 
Upvote 0
A couple possibilities.
Don't know what the calculation is about.
If it is set to automatic, it doesn't need any help with code.
Or am I missing something here?
Code:
Sub AAAAA()
Dim c As Range
    For Each c In Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row)
        With c
            .Offset(-1, 1).Value = c.Value
            .Offset(, 3).Resize(, 2).Value = .Offset(-1, 1).Resize(, 2).Value
        End With
    Next c
End Sub

Code:
Sub AAAAB()
Dim c As Range
    For Each c In Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row)
        Cells(Rows.Count, 2).End(xlUp).Offset(1).Value = c.Value
        Cells(Rows.Count, 4).End(xlUp).Offset(1).Resize(, 2).Value = Cells(Rows.Count, 2).End(xlUp).Resize(, 2).Value
    Next c
End Sub
 
Upvote 0
Thanks for your help, but it's not behaving as expected.
The macro needs to cycle down the items in List A, pasting each Item sequentially into B2 so they can have the results calculated, then past flat each item and it's result at the bottom of list B, and stop when it gets to the bottom of list A. List B will be on a separate tab.

Watching the macro run live..you would see each item in list A be pasted to B2, then B2 and C2 pasted flat at the bottom of list, then the macro would go to the next item on list A and repeat until it reaches the end. List B would be accumulated down the page as the macro runs through each item (iteration) in list List A

The calculation between cells and B2 and C2 in reality will be a major work book that will have 25 different results, and there will be 400+ items in list A.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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