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>
 

jolivanes

Well-known Member
Joined
Sep 5, 2004
Messages
1,390
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
 

JamesGilchrist

New Member
Joined
Apr 12, 2011
Messages
13
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.
 

Forum statistics

Threads
1,077,855
Messages
5,336,782
Members
399,102
Latest member
chudson1

Some videos you may like

This Week's Hot Topics

Top