Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / February 2007

Tip: Looking for answers? Try searching our database.

Another (probably simple) scope question- named ranges in sheet vs. module code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keith - 01 Feb 2007 20:40 GMT
XL2003, sheet names are sheet codenames not the tab names.

I have a named range on Sheet1 called "Positions"

The following code in a code module returns the correct match, and evaluates
to a value of 3
   sVal = Sheet11.Range("B5").Value
   JobVal = Application.Match(sVal, Range("Position"), 0)

The /exact/ same code, in a sub behind Sheet11 returns a 1004 runtime error.
sVal = Sheet11.Range("B5").Value
JobVal = Application.Match(sVal, Range("Position"), 0)  '<-- crashes here

sVal in both cases pulls the correct value. The error occurs when trying to
calculate the the JobVal  value.

Is there some reason or rule that says a sheet can't use application.match
on a named range from a different sheet? I use named ranges sometimes for
data validation lists on other sheets, so I'd think it should be ok, but I
can't figure out why this isn't working... or an appropriate workaround. I
suppose I could call a sub in a module and put this value in a public
variable, but I'd like to understand why it doesn't work in the first place!

Thank you,
Keith
Keith - 01 Feb 2007 20:51 GMT
oops, apparently I had the wrong group selected- my apologies, I'll repost
to the originally intended group.
Keith

> XL2003, sheet names are sheet codenames not the tab names.
>
[quoted text clipped - 23 lines]
> Thank you,
> Keith

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
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.