I am using the following code to name a range in my worksheet and then dividing every cell in that range by the corresponding cell in column B and multiplying it by the corresponding cell in column A. Nothing happens when I run the code like it is, but if I substitute a range (like AU4:AT) for Rng, the macro works. But I need to name a dynamic range because the cells that I am changing are not always in the same place, but the first cell is always two rows below the first 'Pay' in the second row. Any help would be appreciated. Thanks!
Sub Test()
Dim Rng As Range
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Rows("2:2").Select
Selection.Find(What:="PAY", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(2, 0).Select
Set Rng = Range(ActiveCell, ActiveCell.End(xlDown).End(xlToRight))
Range("Rng" & LR) = Evaluate("Rng" & LR & "/B4:B" & LR & "*A4:A" & LR)
End Sub
Sub Test()
Dim Rng As Range
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Rows("2:2").Select
Selection.Find(What:="PAY", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(2, 0).Select
Set Rng = Range(ActiveCell, ActiveCell.End(xlDown).End(xlToRight))
Range("Rng" & LR) = Evaluate("Rng" & LR & "/B4:B" & LR & "*A4:A" & LR)
End Sub