Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Excel VBA Lookup Functions

I have created a function using VBA (below) which assigns a vlookup value in
the calling cell. Code is below.

Function CreateHierachy(AccountParentID As String) As Variant
CreateHierachy = "=vlookup(" & AccountParentID & ",
$A$2:$G$65536,7,False)"
End Function

Above code has been simplified.

The function retrieves the string "=vlookup(1, $A$2:$G$65536,7,False)"
excluding the quotes. I want the cell to read the vlookup value as a formula
(not a string).

How can I do this within the function?

Thanks dudes.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Excel VBA Lookup Functions

Do you mean

Function CreateHierachy(AccountParentID As String) As Variant
CreateHierachy = Evaluate("=vlookup(" & AccountParentID & _
", $A$2:$G$65536,7,False)")
End Function

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"hoppermr" wrote in message
...
I have created a function using VBA (below) which assigns a vlookup value

in
the calling cell. Code is below.

Function CreateHierachy(AccountParentID As String) As Variant
CreateHierachy = "=vlookup(" & AccountParentID & ",
$A$2:$G$65536,7,False)"
End Function

Above code has been simplified.

The function retrieves the string "=vlookup(1, $A$2:$G$65536,7,False)"
excluding the quotes. I want the cell to read the vlookup value as a

formula
(not a string).

How can I do this within the function?

Thanks dudes.



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
excel lookup functions nkc_esquire Excel Discussion (Misc queries) 11 December 20th 06 09:55 PM
Excel Datalist functions / lookup summary [email protected] Excel Discussion (Misc queries) 2 May 26th 06 08:11 PM
INFORMATION ON FUNCTIONS IN EXCEL (EX. "IF", VALUE LOOKUP) skye1971 Excel Worksheet Functions 1 February 1st 06 07:27 PM
Excel Lookup Functions Paul Adams Excel Worksheet Functions 0 November 10th 04 03:16 PM
Excel Lookup Functions Paul Adams Excel Worksheet Functions 1 November 10th 04 02:40 PM


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