LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default named ranges in building excel formulas from a string

I have two ranges named PReq and QOutput.

I have this procedu


Sub test_dependency()
Call dependency(Worksheets("PP"), [PReq], [QOutput], "testtitle")
End Sub


And I have:


Sub dependency(Result As Worksheet, Ratiorange As Range, Qrange As
Range, Title As String)
row_id = some array which results in a value
[Yearstart].value = 5
rowitem = 5
colitem = 5
z=10
Result.Cells(rowwriter, z).formula = "=vlookup(" & row_id(rowitem, 1)
& "," & Qrange.name & "," & z - [Yearstart].Value + 1 & ",false) *
index(" & Ratiorange.name & "," & rowitem & "," & colitem & ")"


I desperately want the formula to look like:


=vlookup(4,PReq,6,false)*index(QOutput,5,5)


I'll take


=vlookup(4,PReq!$b$5:$h$100,6,false)*index(QOutput !$b$5:$g$10,5,5)


but I get


=vlookup(4,=PReq!$b$5:$h$100,6,false)*index(=QOutp ut!$b$5:$g$10,5,5)


I've tried Qrange.name, .address, .value, .text anything. they all
dont' work. Then I tried to go through the Locals window and when I
clicked onto Qrange - Cells - Name, lo and behold, it was "QOutput".
So then I tried


?Qrange.cells.name in the immediate window and got a syntax error


same with:


?[Qrange].cells.name and ?Range("QRange").cells.name


Tell me your learning curve is as steep as mine because this should be
very obvious



 
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
Named ranges and pasting formulas with named references Dude3966 Excel Programming 2 October 8th 08 04:15 PM
building formulas that change frequently using named cell ranges Sheldon Excel Worksheet Functions 4 December 6th 07 04:35 PM
dynamically building references to named ranges [email protected] Excel Discussion (Misc queries) 1 January 3rd 06 10:23 PM
Delete named ranges beginning with a string GoFigure[_7_] Excel Programming 2 December 4th 05 12:23 PM
protecting formulas with named ranges Robin Excel Programming 3 September 5th 05 03:47 AM


All times are GMT +1. The time now is 05:01 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"