Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Relative Reference


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

--
liseladel
-----------------------------------------------------------------------
liseladele's Profile: http://www.excelforum.com/member.php...fo&userid=3268
View this thread: http://www.excelforum.com/showthread.php?threadid=53731

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Relative Reference

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

--
Regards,
Tom Ogilvy



"liseladele" wrote:


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/ whatever
row it is in. So in row 7 it should be Q7 and in row 8 it should be Q8
and so on. I believe this is called relative reference...but I can't
figure out how to make it work. Can anybody help?

Thanks in advance!![/font]


--
liseladele
------------------------------------------------------------------------
liseladele's Profile: http://www.excelforum.com/member.php...o&userid=32688
View this thread: http://www.excelforum.com/showthread...hreadid=537318


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Relative Reference

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

--
Regards,
Tom Ogilvy


"liseladele" wrote:


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/ whatever
row it is in. So in row 7 it should be Q7 and in row 8 it should be Q8
and so on. I believe this is called relative reference...but I can't
figure out how to make it work. Can anybody help?

Thanks in advance!![/font]


--
liseladele
------------------------------------------------------------------------
liseladele's Profile: http://www.excelforum.com/member.php...o&userid=32688
View this thread: http://www.excelforum.com/showthread...hreadid=537318


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Relative Reference Hari Excel Discussion (Misc queries) 4 October 26th 05 02:00 AM
relative reference Charlie New Users to Excel 3 December 3rd 04 07:22 PM
Relative Reference Don[_16_] Excel Programming 2 May 4th 04 10:40 PM
relative reference Duce Excel Programming 1 October 24th 03 09:44 PM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"