Creating a loop

Farrie

New Member
Joined
Nov 19, 2012
Messages
16
I hope someone can help, I have data which I have sorted using the recorder. I now want the recording to loop and to continue until the last cell of the data.

ActiveCell.FormulaR1C1 = "=IF(OR(RC[4]=""down"",RC[4]=""),"""",MID(R2C3,9,7))"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=IF(OR(RC[3]=""down"",RC[3]="","""",MID(R2C3,20,20))"
Range("A2:B2").Select
Range("A2:B2").AutoFill Destination:=Range("A2:B2" & LastRow)

I would like the macro to loop when column E in two consecutive rows e.g E4 and E5 are equal to "down" then it should repeat both if statements above. It should loop by offsetting : down 1 row and back 4 columns for the first if statement and then down 1 row and back 3 columns
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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