Hello,
I have a sub called abc which does some calculations and returns the results in the range b2:i2 of Sheet1. I want to run this sub multiple times, and each time paste the results in Sheet2 such that next results will be pasted in the row below the previous one. I have written the following code, but it doesn't work:
Sub abc_sim ()
Dim i As Integer, c As Integer
Dim rs1 As Range, rs2 As Range
c = 1
rs1 = Worksheets("Sheet1").Range("b2:i2")
rs2 = Worksheets("Sheet2").Range("b2:i2")
For i = 1 To 100
Call abc
rs1.Copy
rs2.Offset(c, 0).PasteSpecial Paste:=xlPasteValues
c = c + 1
Next i
End Sub
Could someone please help fixing this code.
Thank you,
Shawn
I have a sub called abc which does some calculations and returns the results in the range b2:i2 of Sheet1. I want to run this sub multiple times, and each time paste the results in Sheet2 such that next results will be pasted in the row below the previous one. I have written the following code, but it doesn't work:
Sub abc_sim ()
Dim i As Integer, c As Integer
Dim rs1 As Range, rs2 As Range
c = 1
rs1 = Worksheets("Sheet1").Range("b2:i2")
rs2 = Worksheets("Sheet2").Range("b2:i2")
For i = 1 To 100
Call abc
rs1.Copy
rs2.Offset(c, 0).PasteSpecial Paste:=xlPasteValues
c = c + 1
Next i
End Sub
Could someone please help fixing this code.
Thank you,
Shawn