+ Reply to Thread
Results 1 to 9 of 9

UK post code calculator

  1. #1
    Registered User
    Join Date
    10-27-2005
    Posts
    14

    Exclamation UK post code calculator

    Hi guys,

    I need to calculate the distance between a list of UK postcodes...

    I have found a macro which does it, but you have to manually enter the two postcodes and then it will populate the distance data on the sheet.

    See the attached file as to what I am working with...

    Now what I want it to do, is automatically calculate the distance based 2 coloums on the excel sheet... so I don't have to manually enter the information and perform the calculation 1 by 1...

    is there anyway I can make the macro automatically populate the input postcodes into the user form based on a list of cells with those values in?

    Thanks very much
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: UK post code calculator

    This may help i created it a few months back, it uses the internet to get the distances:

    open it up then right click and select distance from the bottom
    Attached Files Attached Files
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  3. #3
    Registered User
    Join Date
    10-27-2005
    Posts
    14

    Re: UK post code calculator

    The macro I have uses the internet too, but I need it so it doesn't rely on user form input and instead looks up cell values, so I can calculate 500+ distances..

    Any ideas?

  4. #4
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Talking Re: UK post code calculator

    Hi Mate figured it out buddy, you loop through the cells in A and pass the values into the data query then write the results back here you go:
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: UK post code calculator

    oh yeah you may want to put the following in at the top of the sub routine:
    Please Login or Register  to view this content.
    Otherwise if the user enters and invalid POstcode it will debug.

    if i were you i'm write in a rountine after to count the nil returns and advise the user to check the postcodes.

    Cheers

  6. #6
    Registered User
    Join Date
    10-27-2005
    Posts
    14

    Re: UK post code calculator

    brilliant that works!!..

    One last questions, some of my post codes wont work and for some distances I only have town to town, probably not recognised by the internet calculator...

    so is there a way of doing just what you have done but for distance between towns in the uk?

    if not, no worries, appreciate your quick help on this matter

    Thanks again
    Last edited by nevs; 03-29-2011 at 08:22 AM.

  7. #7
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: UK post code calculator

    Hmmm,

    i'm not sure only think i can think of is forcing the postcode values to change?

    for example IF LS45 is creatig an error try forcing it to LS1 etc?

    and anyway how do you know which of the two is incorrect to bein with?

    Hope that helps

    Cheers

  8. #8
    Registered User
    Join Date
    10-27-2005
    Posts
    14

    Re: UK post code calculator

    I am calculating distances from one fixed point to lots of other places within the UK, so the first value always stays the same, so I know which post code is wrong/not recognised

  9. #9
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: UK post code calculator

    there you go then alter the second value to the postcode below it or above it i.e. LS45 error so try LS44 and so on

+ 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