+ Reply to Thread
Results 1 to 8 of 8

Tool to lookup policy numbers when given a string to decode

  1. #1
    Registered User
    Join Date
    03-10-2016
    Location
    Spokane, WA
    MS-Off Ver
    2010
    Posts
    5

    Tool to lookup policy numbers when given a string to decode

    Hello Forum,

    I am a first time poster, long time viewer. I have been a techie for a long time, but never thought myself a programmer. I currently work for a fortune 100 Insurance company as a lower-man on the totem pole, looking to develop this tool to take a lot of the waste out of the process, make it better for our customers, and cut down on wasted labor costs. This being said, this code is mostly what I have taught myself, through some old school text books and from Google. So here is what I have started, I understand the formatting will likely make the more tenured folks have meltdown, so I am open to any revisements, BUT I am most interested in how to get the main tool to reference back and forth between worksheets.

    I had been working on only one sheet in the workbook, and it was working fine. I have 15 cells ready for input, when the go button is selected it takes these cells and searches a table of example policy numbers and should bring up a message box with the department this is and the phone number to call. I started wanting it to just highlight the section where it explains the formatting of the number given, but think in order for the higher-ups to want to take it and run, it will need to be relatively polished and require little training... haha. So with all that, here is the code.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 03-10-2016 at 08:32 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Tool to lookup policy numbers when given a string to decode

    Perhaps a workbook example would be better, with or without the code.

    In your workbook, show some examples of the inputs that could be given and the expected results of the lookup. It may well be possible with no VBA at all, but we'll have a look either way.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-10-2016
    Location
    Spokane, WA
    MS-Off Ver
    2010
    Posts
    5

    Re: Tool to lookup policy numbers when given a string to decode

    Okay I think I attached it. Now the formulas were working on the "Long" Sheet, when the references were ActiveSheet. then I tried to change this to be able to use the front, "Identi Pol", sheet. I was advised by a coworker to have the first sheet be the input, then do the calculation on "Long" sheet and then return the message box on the first sheet so that they user couldn't mess with the table or get confused.

    So if this method sounds to be a good way to approach this I just need, for now, the understanding for how to put the characters into the first page, that are then grabbed by the second page. Press the button on the first page, it runs the macro'd button on the second page, runs the search, and returns the answer on the first page. The answer would take the table item selected from the table and return it in a message box.

    Thank you again for your reply and assistance!
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Tool to lookup policy numbers when given a string to decode

    Ok, since you didn't give me the example results/samples I asked for, I'll try to answer blindly.

    Your ButtonClick1 macro has numerous hardcoded references to the sheet "Long". I would recommend declaring a sheet variable, then using that variable all through the code. If the code continues to work as originally designed with this one change, you would then link that variable to your new sheet to test.

    Here's your original code with the new variable created for the original test:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-10-2016
    Location
    Spokane, WA
    MS-Off Ver
    2010
    Posts
    5

    Re: Tool to lookup policy numbers when given a string to decode

    Sorry, I wasn't understanding how you wanted the examples. In this, I would type WC5-35S-456789-123 into the search box and then it would use the coding where one of the elseif statements has

    Please Login or Register  to view this content.
    So it would select the range on Sheet "Long" and highlight this section that discusses Involuntary markets. At this point this is all that I had, the selection of the right info. Once I had most of the impossibly many if then elseif statements to separate the many ways our policy numbers can be coded, and had this working 99% of the time, then I wanted to make it display this info neatly and not simply show the selection in the table.

    *Very similar to Middle Markets* Ex Pol. WC2-35S-456852-012
    6th character is a S WC5-53S-456000-015 Involuntary Markets Service

    **Call 800-###-####**

    I am very appreciative for the info so far, I will try this code later today and get back to you. I don't expect you to do all the legwork here, but the help around the seemingly obvious is very helpful
    Last edited by JBeaucaire; 03-11-2016 at 05:56 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Tool to lookup policy numbers when given a string to decode

    I've added the missing CODE tags above again, please try to remember.

    Another tip, this can be simplified:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-10-2016
    Location
    Spokane, WA
    MS-Off Ver
    2010
    Posts
    5

    Re: Tool to lookup policy numbers when given a string to decode

    So now I am getting this error. I think its related to how I am defining things. I need the pos1 - pos15 to be able to accept input of one character and then to be able to assess If this is a number, letter, or in some cases certain specific characters and do the search based on this.

    So I have my pos variables dimmed as Strings
    Then when I do the pos1 = wsLookup.Cells(M5) line
    If I use .Cells or .Range or add .Value on the end - it doesn't seem to like the way I am asking for this type of data, is this correct?

    Sorry I just saw the message about CODE tags and am going to read this.
    I have now read and will do this when posting code.
    Attached Images Attached Images
    Last edited by Caraway_d; 03-11-2016 at 06:21 PM. Reason: Fixed .png to .jpg

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Tool to lookup policy numbers when given a string to decode

    CELLS(5, 13)

    That's M5.


    Perhaps you meant:
    Please Login or Register  to view this content.

+ 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. Macro to search last 4 numbers of a policy number, help.
    By Rick23 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-27-2014, 01:05 AM
  2. vba code to search last 4 numbers of a 10 digit policy number
    By Rick23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2014, 10:21 PM
  3. Replies: 2
    Last Post: 08-09-2014, 12:40 PM
  4. [HELP] Creating Lookup Tool
    By icesaiah in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2013, 03:14 AM
  5. [SOLVED] Replace string with another string from another worksheet (like decode)
    By sugee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2013, 02:05 AM
  6. Replies: 2
    Last Post: 08-23-2012, 04:58 PM
  7. Replies: 1
    Last Post: 11-17-2005, 01:55 PM

Tags for this Thread

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