Solved

Getting a value from an array?

Posted on 2014-07-31
6
90 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
  • 4
6 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 250 total points
Comment Utility
Hi,

pls try

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

Regards
0
 

Author Comment

by:RWayneH
Comment Utility
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
Comment Utility
ActualFinishToUse = WorksheetFunction.VLookup(CH_FinGrp, Range("A1:C18"), 2, 0)

is failing.  "unable to get vlookup property of the WorkSheetFunction class
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:RWayneH
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the help.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now