Thread
:
Simple Loop question
View Single Post
#
5
Posted to microsoft.public.excel.programming
fedude
external usenet poster
Posts: 74
Simple Loop question
Thanks Nigel. This got me off to a good start. Unfortunately the rows and
column don't match up for a nice "transpose".
"Nigel" wrote:
Sub CopyCalc()
Dim sh1 As Worksheet, sh2 As Worksheet
Dim r1 As Range, c1 As Range, c As Long
Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")
' set top left cell for range on sheet1 and sheet2
Set r1 = sh1.Range("A1")
Set c1 = sh2.Range("A1")
For c = r1.Row - 1 To r1.Row + 23
Range(r1.Offset(c, 0), r1.Offset(c, 4)).Copy
c1.PasteSpecial Transpose:=True
'code to print you output
Next
End Sub
--
Regards,
Nigel
"fedude" wrote in message
...
I have 2 sheets in a workbook. Sheet1 contains 25 rows of data. Sheet2
contains a column of 5 cells that are the basis for a large calculation
within that sheet. Today I'm manually loading up the 5 cells and then
running a macro to print out the results.
I want a routine that loops through the 25 rows of Sheet1 and for each
row,
copies 5 of the cells (in that row) into the appropriate cells in Sheet2
and
then run the print macro. I'd like to run this routine from Sheet2 if
that
matters.
The data in Sheet1 is in rows and the destination of the values in Sheet2
is
in a column
Reply With Quote
fedude
View Public Profile
Find all posts by fedude