View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default From a fixed cell to a variable

Call_Ask
"INDEX(ESX!$L$10:$L$600,MATCH(1,(ESX!$F$10:$F$600= 'ID'!DXXX)*(ESX!$G$10:$G$600='ID'!$R$2)*(ESX!$I$10 :$I$600=""Call""),0))"

for i = 4 to 13
If Range("B" & i).Value = "Synthetic" Then
Call_Ask = Replace(Call_Ask,"XXX",i)
exit for
Next i

--
Regards,
Tom Ogilvy


" wrote:

hello all, and once again I am looking for help on a expression writing
issue.
I had the following code working just fine thanks to the help I
received here a few months ago.

Call_Ask =
"INDEX(ESX!$L$10:$L$600,MATCH(1,(ESX!$F$10:$F$600= 'ID'!D4)*(ESX!$G$10:$G$600='ID'!$R$2)*(ESX!$I$10:$ I$600=""Call""),0))"

But (ESX!$F$10:$F$600='ID'!D4)
Cannot refer at D4 anymore but a number which can be between 4 and 13.
I am defining this exact line number using following code;

For i = 4 To 13
If Range("B" & i).Value = "Synthetic" Then Line1 = i

I thus tried to write the new code as

Call_Bid = "INDEX(ESX!$K$10:$K$600,MATCH(1,(ESX!$F$10:$F$600= 'ID'!""D&
Line1")*(ESX!$G$10:$G$600='ID'!$R$2)*(ESX!$I$10:$I $600=""Call""),0))"

Which obviously did not work. I am dumb but I am still missing the
logic when introducting variables into cell references...

Many thanks if anybody can help
Regards,
Daniel