Help With Looping - URGENT

VitesseCarOwner

Board Regular
Joined
Jun 29, 2012
Messages
79
I'm new to using VBA and am struggling to setup a loop, so am looking for help. Cell Z4 has this formula =INDEX($O$4:$O$22778,MATCH(1,(R4=$I$4:$I$22778)*(S4=$J$4:$J$22778)*(T4=$K$4:$K$22778),0)) which has been entered as an array formla.

How would I setup a macro so that cell Z4 is copied and pasted into cell Z5, cell Z5 should then be copied and pasted as a value a second macro will then run, cell Z4 should then be copied again and then copied into cell Z6, cell Z6 should then be copied and pasted as a value a second macro will then run. Hopefully you get the idea

The loop needs to run up to cell Z22778.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Something like this?

Code:
Sub dtest()
Range("Z4").AutoFill Destination:=Range("Z4:Z22778")
With Range("Z5:Z22778")
    .Value = .Value
End With
End Sub
 
Upvote 0
Perhaps (a long shot):

Code:
Sub dtest()
dim l as long
for l = 5 to 22778
   Range("Z4").Copy Range("Z" & l)
   'your other macro code
   Range("Z" & l).Value = Range("Z" & l).Value
next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

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