mmetzinger
Board Regular
- Joined
- Dec 30, 2010
- Messages
- 61
Ok, need some help in the formula line of the code below I need it to use the stored value instead of a set cell reference but I can't figure out the syntax.
Thanks for any help you can give me!
Code:
Sub test()
Dim c As Range
Dim R1 As Integer
Dim R2 As Integer
R1 = 2
Dim fillto As String
Dim newa As String
For Each c In Range("A:A")
If Columns("A").Find(What:="Total", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate Then
R2 = ActiveCell.Row
fillto = "D" & R2
Cells(R1, 4).Select
[COLOR=Red] ActiveCell.FormulaR1C1 = "=RC[-1]" / fillto[/COLOR]
Range("D2").Select
Selection.Autofill Destination:=Range("D2", fillto), Type:=xlFillDefault
newa = "A" & R2
R1 = R2 + 1
Range(newa).Select
End If
Next c
End Sub
Thanks for any help you can give me!