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.
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Something like this?

Code:
Sub dtest()
Range("Z4").AutoFill Destination:=Range("Z4:Z22778")
With Range("Z5:Z22778")
    .Value = .Value
End With
End Sub
 

VitesseCarOwner

Board Regular
Joined
Jun 29, 2012
Messages
79
Unfortunatly, I need to run a second macro once each cell has changed before moving to the next cell.
 

wigi

Well-known Member
Joined
Jul 10, 2006
Messages
7,958
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,233
Messages
5,594,963
Members
413,954
Latest member
mrsandy

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
Top