Solved

Getting a value from an array?

Posted on 2014-07-31
6
96 Views
Last Modified: 2014-08-06
I have a value stored in a name called CH_FinGrp, in this case it is: X1, however X1 will refer to a value in a table on a sheet named: FinGrpFinUsedTable
How do I look down column A of the FinGrpFinUsedTable sheet to find the CH_FinGrp value, then grab the value in the cell to the right (offset one column right)
Then give that a name to use, like ActualFinishToUse = the result found?

So in my example, if X1 is the value of CH_FinGrp, it should return TR_E and assign that the name ActualFinishToUse
FinGrpFinishUsedTable.xlsx
0
Comment
Question by:RWayneH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 40231735
Hi,

pls try

CH_FinGrp = "X1"
ActualFinishToUse = WorksheetFunction.VLookup(CH_FinGrp, Range("A1:C18"), 2, 0)

Regards
0
 

Author Comment

by:RWayneH
ID: 40231827
Can this be made more dynamic?  Perhaps if I name the range ("A1::C18") to "FinGrpTable"  How would this change the way this looks?
0
 

Author Comment

by:RWayneH
ID: 40231865
ActualFinishToUse = WorksheetFunction.VLookup(CH_FinGrp, Range("A1:C18"), 2, 0)

is failing.  "unable to get vlookup property of the WorkSheetFunction class
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:RWayneH
ID: 40231918
Ok got this to work... now.  How do I remove absolute locations and use a name?
0
 
LVL 27

Assisted Solution

by:Glenn Ray
Glenn Ray earned 250 total points
ID: 40233434
If you're expecting the size of the table - currently in A1:C18 - to change, then I recommend you define it as a Table in Excel (Menu: Insert, Table...accept defaults).  The range will be named "Table1" by default; you can change that name in the Name Manager (Menu: Formulas, Name Manager).  Just highlight Table1, click Edit, then change the name (ex., FinGrpTable).

Then, in the VBA code you can replace any occurence of
A1:C18
with the new table name (ex., "FinGrpTable").

An Excel Table is very dynamic and the range will expand as needed when/if new rows are added.

Regards,
-Glenn
0
 

Author Closing Comment

by:RWayneH
ID: 40244340
Thanks for the help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question