In the rtmp function, I want to pass the loop iterator i into the getRTMP function to just keep track of the row it's on. When I try to type "getRTMP (0.7, i)" into line 15 and press enter, I get a message box saying "Compile error: Expected: list separator or )" error. My objective is to paste the value from L7 on the row i, within the getRTMP function.
I'd like to be able to add more lines like "getRTMP (0.8, i)", "getRTMP (0.9, i)", etc., but this is stopping me at just the first case.
Is this even possible? I feel like it shouldn't be this difficult and I'm missing something obvious. Maybe the types are off (sorry, slight newbie to VBA here), but I think they check out.
My current code (edited truly unrelated parts out):
Sub rtmp()
Dim i As Integer
' Run accts
For i = 3 To 18
' Paste accts to get data
Sheets("RTMP calcs").Select
Range("A" & i).Select
Selection.Copy
Sheets("Savings Summary").Select
Range("I1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
getRTMP (0.7)
getRTMP (0.7, i) 'Ideally, this is what the previous line would look like
Next i
End Sub
Sub getRTMP(ByVal CBL As Single, ByVal i As Integer)
Dim CBL As Single
Dim i As Integer
' Sets the CBL %
Sheets("Savings Summary").Select
Range("P6").Select
Selection.Value = CBL
' Copy CBL
Range("L7").Select
Selection.Copy
Sheets("RTMP calcs").Select
Range("G" & i).Select 'This line and the one below aren't in yet,
Selection.Paste 'but this is what it would basically look like
End Sub