ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Another simple little problem (https://www.excelbanter.com/excel-programming/281299-another-simple-little-problem.html)

Jerry[_14_]

Another simple little problem
 
Hi,
This program takes values from 5 arrays, pastes them (line
by line) into a model, then picks up the bottom line of
the model and pastes this bottom line into some results
columns. Here the problem: The model has 4 output numbers
(sheet2 B8:B11). However, the macro only picks up these 4
numbers for the first input line (row 6). After this, the
macro only picks up the number in sheet1 cell B8 (and not
B9:B11 as it is intended to do). What is wrong with the
macro?
Thanks,
Jerry

Sub Model()


Dim cell As Range

For Each cell In Worksheets("sheet1").Range("N6:N325")
cell.Resize(1, 5).Copy


With Worksheets("sheet2")

.Range("B2").PasteSpecial Transpose:=True
cell.Offset(0, -5).Value = .Range("B8:B11").Value

End With


Next

End Sub


Tom Ogilvy

Another simple little problem
 
cell.Offset(0, -5).Resize(4,1).Value = .Range("B8:B11").Value

--
Regards,
Tom Ogilvy


Jerry wrote in message
...
Hi,
This program takes values from 5 arrays, pastes them (line
by line) into a model, then picks up the bottom line of
the model and pastes this bottom line into some results
columns. Here the problem: The model has 4 output numbers
(sheet2 B8:B11). However, the macro only picks up these 4
numbers for the first input line (row 6). After this, the
macro only picks up the number in sheet1 cell B8 (and not
B9:B11 as it is intended to do). What is wrong with the
macro?
Thanks,
Jerry

Sub Model()


Dim cell As Range

For Each cell In Worksheets("sheet1").Range("N6:N325")
cell.Resize(1, 5).Copy


With Worksheets("sheet2")

.Range("B2").PasteSpecial Transpose:=True
cell.Offset(0, -5).Value = .Range("B8:B11").Value

End With


Next

End Sub





All times are GMT +1. The time now is 12:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com