Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2004, 02:24 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default character to range conversion for VLOOKUP

I want to compute a range name, JLE, say, from VBA code, which
is returned in cell A1 and then to use the contents of A1
as the second argument in VLOOKUP. The output type of my function
would appear to need to be of type "Range". When it is
string type, it does not work. This must be really elementary -
I am just getting into VBA, but it is frustrating. Ideas?

In more detail, In A2, if I manually enter =VLOOKUP(41,JLE,2)
it works. I want instead =VLOOKUP(41,+a1,2)
to work. The problem is that the contents of a1 are recognized
as character, not as a range name. I need to somehow convert +a1
to a range object. Ideas?

Gary
 
Old May 26th, 2004, 05:10 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Gary
If you mean how to use VBA code to lookup values,
use this syntax:

answer=WorksheetFunction.VLookup(41, Range(Range("A1")), 2)

-vemaju






Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlookup with VBA andygill Excel VBA 2 November 6th, 2008 06:44 PM
VLookup with Strings Problem dem1an Excel VBA 1 June 3rd, 2008 10:46 AM
VLookup, arrays, and worksheet names chp Excel VBA 0 April 7th, 2006 03:15 PM
string character conversion Neal XSLT 2 February 23rd, 2006 08:23 AM
IMP-00016: required character set conversion not saravananedu Oracle 1 September 7th, 2004 05:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.