Relative Reference

L

liseladele

I've recorded the following macro:

Sub 2()
'
' 2 Macro
' Macro recorded
'
' Keyboard Shortcut:
'
Dim i As Integer
i = 4
Do
ActiveCell.Formula = "=Q6/(HLOOKUP($R$2, $C$3:$O$40, (" & i
")))"
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop Until IsEmpty(ActiveCell.Offset(1, 0))
'
End Sub

My problem is I need the Q6 in the formula to correspond w/ whateve
row it is in. So in row 7 it should be Q7 and in row 8 it should be Q
and so on. I believe this is called relative reference...but I can'
figure out how to make it work. Can anybody help?

Thanks in advance!![/FONT
 
G

Guest

Sub 2()
'
' 2 Macro
' Macro recorded
'
' Keyboard Shortcut:
'
Dim i As Integer
i = 4
Do
ActiveCell.Formula = "=Q" & activecell.row & _
"/(HLOOKUP($R$2, $C$3:$O$40, (" & i & ")))"
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop Until IsEmpty(ActiveCell.Offset(1, 0))
'
End Sub
 
G

Guest

ActiveCell.Formula = "=Q" & activecell.row & _
"/(HLOOKUP($R$2, $C$3:$O$40, (" & i & ")))"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top