vinvinvin123
New Member
- Joined
- Jul 19, 2017
- Messages
- 16
Hello!
I am recording a macro to process sheet. Here is the code:
Dim r As Integer
r = Range("U1").Value
i = Cells(2, r + 7).Select
Range("O2").Select
ActiveCell.FormulaR1C1 = _
"=SUMPRODUCT formula here....
Range("O2").Select
Selection.Copy
Range(Cells(2, r + 7), Cells(2, 19)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
I want this to repeat every 9 rows until the first blank cell - I understand that a loop can be used for this but how best to do it? Shall I repeat the whole code + 9 columns each time or just the copy past section at the end? I think both would work but I can't figure out how to do either.. any ideas?
Thanks in advance.
I am recording a macro to process sheet. Here is the code:
Dim r As Integer
r = Range("U1").Value
i = Cells(2, r + 7).Select
Range("O2").Select
ActiveCell.FormulaR1C1 = _
"=SUMPRODUCT formula here....
Range("O2").Select
Selection.Copy
Range(Cells(2, r + 7), Cells(2, 19)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
I want this to repeat every 9 rows until the first blank cell - I understand that a loop can be used for this but how best to do it? Shall I repeat the whole code + 9 columns each time or just the copy past section at the end? I think both would work but I can't figure out how to do either.. any ideas?
Thanks in advance.