Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Looking up the value of a cell in a named range

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Memento - 27 Sep 2007 15:28 GMT
Hello guys,

I'm have a named range in Worksheet1 which is used back on Worksheet2 (as a
list which from which the user can choose).

Depending on what the user selects I want to perform some calculation, but
that's where my problem starts. For example

my named range contains:
- VB
- VC
- VB+
etc...

Depending on what the user chooses in the list on Worksheet2, i will add 2
numbers if chosen VB, or substract 2 numbers, or multiply numbers...

I've tried If... then, Case Else.. and trying to do something like this:

if SelectedCode = Range("CodesRange").Item Then - which doesn't work OR
for each c in Range("CodesRange") - but this doesn't seem efficient.

Anyone has any suggestions about how i can do this in VBA, as efficiently as
possible?

Thanks in advance!

Memento
Joel - 27 Sep 2007 16:20 GMT
Why don't you use a find?

set c =  Range("CodesRange").find(what:=Selectedcode, _
 lookin:xlvalues)
if not c is nothing then

> Hello guys,
>
[quoted text clipped - 24 lines]
>
> Memento
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.