Hello experts
I have a section of code which goes like this.
For i = 3 To 27
Range("co3").Select
ActiveCell.FormulaR1C1 = _
"=CORREL(RC[-6]:R[17127]C[-6],RC[-5]:R[17127]C[-5])"
Selection.Copy
Range("cp" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("cj3").Select
Selection.Delete Shift:=xlUp
Next i
The code (probably messy for you guys) works perfectly and does what I want it to do. However depending on certain conditions of the data I'm using I have to manually change the amount it loops. I have this loop 6 times for 3 different axis so it is quite annoying and time consuming.
Is there a way I can change that number "27" to represent a call value on my work sheet.
For example in cell "A1" I had the value 10 it would just do it 10 times?
Thank you for any help
I have a section of code which goes like this.
For i = 3 To 27
Range("co3").Select
ActiveCell.FormulaR1C1 = _
"=CORREL(RC[-6]:R[17127]C[-6],RC[-5]:R[17127]C[-5])"
Selection.Copy
Range("cp" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("cj3").Select
Selection.Delete Shift:=xlUp
Next i
The code (probably messy for you guys) works perfectly and does what I want it to do. However depending on certain conditions of the data I'm using I have to manually change the amount it loops. I have this loop 6 times for 3 different axis so it is quite annoying and time consuming.
Is there a way I can change that number "27" to represent a call value on my work sheet.
For example in cell "A1" I had the value 10 it would just do it 10 times?
Thank you for any help