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: 2
Default VBA Function to evaluate hlookup text string as formula

I have a simple function using Evaluate to evaluate a text formula. It
works just fine, even if it references other spreadsheets on the
network (the formula has full path). What I can't get it to do
properly is have it evaluate an Hlookup referencing another
spreadsheet on the network if I have the function look to another
cell's text. BUT, if I put the hlookup inside the function, it
evaluates just fine.

Function I added in VBA:
Public Function myFunct(InputString As String)
myFunct = Application.Evaluate("=" & InputString)
End Function

----------------------------
Formula in A14:
=PERSONAL.XLS!myfunct(B14)
Evaluates to:
#REF!

Text in B14:
HLOOKUP(L17,'C:\Documents and Settings\eric\My
Documents\[Book1.xls]Sheet1'!$E$25:$F$25,1,FALSE)
---------------------

Formula in A15:
=PERSONAL.XLS!myfunct(HLOOKUP(L17,'C:\Documents and Settings\eric\My
Documents\[Book1.xls]Sheet1'!$E$25:$F$25,1,FALSE))
Evaluates properly.

----------------------
Formula in A14:
=PERSONAL.XLS!myfunct(B14)
Evaluates to:
Evaluates properly.

Text in B14:
HLOOKUP(B8,8:8,1,FALSE)

So, it looks like it's something to do w/ the way the function
evaluates the text in a cell, versus just passing the text itself into
the function. Why???

I want to make dynamic text+formula strings that extensively use
hlookup, but if I can't get this to work, it'll be manual updates! Any
clues why this one thing doesn't work when it evaluates just fine for
other

Thanks! ER
 
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
Is there a function that will evaluate a text string in a cell? Dave Excel Worksheet Functions 2 October 7th 09 04:25 AM
Function to evaluate function as string Basil Excel Worksheet Functions 3 September 18th 09 10:43 AM
Evaluate text string as a function benb Excel Discussion (Misc queries) 3 July 19th 06 02:41 PM
Evaluate string as a formula peacelittleone Excel Worksheet Functions 3 June 26th 05 06:20 PM
how to evaluate the content of a string as if it was a formula cyrille de brébisson Excel Discussion (Misc queries) 5 December 6th 04 10:47 PM


All times are GMT +1. The time now is 08:15 AM.

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"