+ Reply to Thread
Results 1 to 2 of 2

VBA cross referencing

  1. #1
    Registered User
    Join Date
    04-02-2009
    Location
    Blue Valley, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    1

    VBA cross referencing

    Hello, I'm fairly new to the VBA side of Excel so I'm hoping this question involves an easy answer. Anyway here goes:

    I have a cross reference sheet of roughly 200 cities and the distances between them; the data is roughly layed out like this:

    xxxxx city1 city2 city3
    city1 0000 0580 1296
    city2 0580 0000 3914
    city3 1296 3914 0000
    (the extra 0's are hopefully going to align this better)

    Anyway, my goal is to write a program to have a function that doesn't need the current sheet as a reference. I'm attempt so all you have to do is type:
    =Distance(city1, city2)
    and have the distance displayed.

    My vague memory of c++ give me the idea of writing something like this:

    Select Case city1 = Atlanta
    Case is city2 = Billings
    Distance = 1200
    Case is city2 = Detroit
    Distance = 1680
    ect...

    Though, my lack of knowledge with VBA is preventing me from even passing text through as a String.

    Any help with this would greatly be appreciated.
    -John

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VBA cross referencing

    John

    You don't need to have the matrix on your current sheet, or even in your current workbook if you go down the addin approach.

    Can you give more background on what you want to achieve?

    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1