+ Reply to Thread
Results 1 to 5 of 5

Query US Abreviations

  1. #1
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Query US Abreviations

    Hi guys,

    I have a question.

    I have this code
    Please Login or Register  to view this content.
    How can I develop the code so I will not have all the time to fix range (E.g. in col.D).
    The US abbreviations sometimes are in col.G, or other and I want to run my code, so it will populate in col.Z the full name of the Abreviations.

    If I create a Range ("State") with Ctrl.Shift+F3 Excel will know that maybe the range will be in other column and i want based on the col. V(E.g.) to populate in Z the full name of the US state.
    I don't want to use Range("D2:D200000"), or to edit the macro all the time, when I have a different column set into a spreadsheet. ..so I need to expand my code to auto detect the Range of the State, based on a variable called State...

    Thank you in advance,
    Ionut
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Query US Abreviations

    Hi Ionut,

    This problem sounds like you need one of a few other things.
    1. If you create a Named Range of cells and put in all the names and ID's you might be able to use a VLookup to replace what you want. This might eliminate the need for VBA code.
    2. It looks like you need a Dynamic Named Range so you can move your lookup table around. Then you can use the DNR's in your VBA Code.
    3. If you can't have the table of Names and ID's live in cells on/in your workbook you can make them a Constant Array in the Names Manager and use it to do you lookups.

    read:
    http://www.bettersolutions.com/excel...G820716330.htm
    http://www.databison.com/excel-array...ray-constants/
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: Query US Abreviations

    Thank you Marvin I will read them to see if I will be able to rewrite the code....

    Have a great day,
    Ionut

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Query US Abreviations

    Hi Ionut,

    Here is a better answer using ActiveCell.Column . You simply click in the column you want converted and run the macro while your cursor is in that column. See code and attached:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: Query US Abreviations

    Thank you Marvin!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 09-08-2015, 08:12 PM
  2. Replies: 2
    Last Post: 02-01-2013, 04:21 PM
  3. [SOLVED] Loop through list, perform web query and save each query on its own page
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2012, 07:50 AM
  4. Problem with selecting range with in query table after query refresh
    By shooter in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2012, 11:55 AM
  5. Web Query - Change a word in query to form a new query
    By scottymelloty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2011, 04:13 AM
  6. Excel VBA query time based hyperlink query
    By TAU710 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-13-2010, 03:27 PM
  7. Query Data in hidden rows/columns with Query Box
    By VincetOmnia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 10:53 PM

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