VBA loop for model

johni123

New Member
Joined
Mar 14, 2016
Messages
1
Hey,

THanks in advance.

I am working on a model that copies a 10x7 table from sheet 1 to sheet 2. In sheet 2 the calculations are carried out and the results are copied into sheet 3. I want to do this n number times. The code I have written so far is able to do the first half of the job. However for the last part I have not been able to do it. My code is written bellow.

Sub macro1()
'
' macro1 Macro


For i = 2 To 100

Sheets("Sheet1").Range("A" & i).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Sheet4").Select
Range("A2").Select
ActiveSheet.Paste




Sheets("Sheet2").Range("D" & j).Value = Sheets("Sheet4").Range("U13").Value

Sheets("Sheet2").Range("C" & j).Value = Sheets("Sheet4").Range("G18").Value



i = i + 10


Next i

End Sub
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top