appending calculations to a separate worksheet

D

Driver

I have one worksheet, "wsA" where I'll do all the work and calculations.
Upon completion of the calculations, I want to copy the results to a single
row in a second worksheet, "wsB."

If I do another set of calculations in "wsA," I want the capability to
append the second set of calculations to "wsB," preserving the data from the
first calculations.

If I do 30 sets of calculations in "wsA," when I'm finished I want 30 unique
rows of calculated results in "wsB."

Can someone get me out of the blocks?

Merci Bien
 
D

Dave Peterson

Something like this:

Option Explicit
Option Base 1
Sub testme01()

Dim outWks As Worksheet
Dim calcsWks As Worksheet
Dim oRow As Long
Dim addrCtr As Long
Dim calcAddresses As Variant 'on calculation sheet

Set outWks = Worksheets("wsB")
Set calcsWks = Worksheets("wsA")

'put 30 addresses in the correct order--to match A to AD
calcAddresses = Array("C6", "C7", "C8", "C9", _
"d10", "e11", "f12", "g13")

With outWks
oRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
For addrCtr = LBound(calcAddresses) To UBound(calcAddresses)
.Cells(oRow, addrCtr).Value _
= calcsWks.Range(calcAddresses(addrCtr)).Value
Next addrCtr
End With

End Sub

Give it the 30 addresses that hold the important data.

I assumed that I could use column A to determine the next available row.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
G

GB

You want something like:

Sheets(1).Range("A1:C1").Copy
Destination:=Sheets(2).Range("A1").End(xlDown).Offset(1, 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top