+ Reply to Thread
Results 1 to 14 of 14

Vba if then statement with multiple cases and wildcards

  1. #1
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8

    Vba if then statement with multiple cases and wildcards

    https://drive.google.com/file/d/0B9D...ew?usp=sharing

    ^ this is the link to the spreadsheet so you can visually see what is going on.

    What I need:

    A code that searches (RPA!D5 to last row) against the numbers in (Feature Report!Q to last row), giving me the value if contains one of these values. (First Instance only) 65, 64.99, 40, 45, 30, 35, 15, 20, 10, 50 then put that number in (RPV!)

    A code that searches (RPA!D5 to last row) against the numbers in (Feature Report!Q to last row), giving me the value if (Feature Report!AI2 to last row) contains a wildcard such as (*EPTT*) so if it is EPTT05 give me the value next to it (Feature Report!AM) put that number in (RPAA!) I need this to add all the values up. Since one phone number can have multiple instances of the feature MRC.

    A code that copies all the phone numbers from (Smart Report:Q2 to Last Row) and paste them in (RPA:D5 to Last row).






    Below is a code that I Have at the moment. The issue with it, is that it doesn't do Wildcards, and has the static range of 5-3004 rather than 5-last used row. The last used row is still being judged by column D. Once I have the code done once, I will use it as a template to complete the project.

    Please Login or Register  to view this content.
    Last edited by LightKerosene; 09-25-2015 at 04:01 PM. Reason: Thought of something needed.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: VBA Macro Needed

    Upload your workbook to this forum.

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8
    Fixed, I think

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Vba if then statement with multiple cases and wildcards

    Quote Originally Posted by LightKerosene View Post
    Fixed, I think
    You missed the first request.
    Upload your workbook to this forum.

    ViewPic.

  5. #5
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8

    Re: Vba if then statement with multiple cases and wildcards

    I tried. That's why I posted the google doc. The workbook is 6mb. This site allows 1mb.

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Vba if then statement with multiple cases and wildcards

    Quote Originally Posted by LightKerosene View Post
    I tried. That's why I posted the google doc. The workbook is 6mb. This site allows 1mb.
    Try zipping it and uploading the zip folder.

  7. #7
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8

    Re: Vba if then statement with multiple cases and wildcards

    Here ya go.
    Attached Files Attached Files

  8. #8
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Vba if then statement with multiple cases and wildcards

    What does this mean, it's confusing?
    giving me the value if contains one of these values. (First Instance only) 65, 64.99, 40, 45, 30, 35, 15, 20, 10, 50 then put that number in (RPV!)
    Then, what is RPV?
    I don't see a sheet named RPV.

    A code that copies all the phone numbers from (Smart Report:Q2 to Last Row) and paste them in (RPA:D5 to Last row).
    What about the phone numbers and other data that maybe be in RPA already?

  9. #9
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8

    Re: Vba if then statement with multiple cases and wildcards

    The data that is in RPA already should be deleted when you paste the data from column Q. Since it is just the phone numbers.

    As for RPV. it is a typo for RPAV! My apologies.

  10. #10
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Vba if then statement with multiple cases and wildcards

    As for RPV. it is a typo for RPAV! My apologies.
    I don't see a sheet named RPAV either.


    Okay, well if you want me to help you, then read my posts carefully and understand that it's not apparent what you want, at least to me, and where you want it, hence that is why I said your explanation is confusing, "What does this mean". I don't want to go back and forth with you. Details and more details. Use sheet names cell addresses etc. to explain what you want. If you were expecting only the one wildcard match make that apparent if you were expecting more than one, then we need to know the whole of what you expect.

  11. #11
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8

    Re: Vba if then statement with multiple cases and wildcards

    RPA!V5 to end row. gosh I suck today.

    Example *EPTT*

    Will return EPTT05, EPTT05FMS, EPTT030, EPTTBlah, BlahEPTT.

    It will add the value from AM for each found case. And put the added value of the EPTT's found into Column RPA!V whatever phone number it is associated with.

    Explaination of tabs, incase it helps
    Feature Report = Report of all features on said phone number
    Smart Report = Basic report of lines that are on an account.
    RPA = The Rate Plan Analysis that we help make for customers.
    Macro information = Macro stuff.
    Macro Settings = Incase you need to put a variable on another sheet temporarily.


    Example below (Ranges aren't set correctly, but it gives you an idea of what I mean)
    Please Login or Register  to view this content.
    Last edited by LightKerosene; 09-25-2015 at 05:01 PM. Reason: code

  12. #12
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Vba if then statement with multiple cases and wildcards

    I don't know how to get you on the same page as me.
    Again go back to post #8, I say what does this mean and below that is a quote from your post with a bunch of numbers 65, 50, etc.
    What does that mean, explain where those numbers are, what you want to do with those numbers, are they in the phone number, can they be in the phone number, beginning end anywhere? Details.

    Example *EPTT*

    Will return EPTT05, EPTT05FMS, EPTT030, EPTTBlah, BlahEPTT.
    Yeah I get that part, otherwise I don't belong here.


    If you were expecting only the one wildcard match make that apparent if you were expecting more than one, then we need to know the whole of what you expect.
    Meaning *EPTT*, you have a bunch of other possibilities in that column, for instance you have 10APL, do you want *10APL* or any other possibilities, so I may decide how to code this.

  13. #13
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8

    Re: Vba if then statement with multiple cases and wildcards

    those numbers are all the possible MRC for that particular code.
    I did this code already, see below. The problem with it is that it is limited to 5-3004 instead of end row. and I cannot use wildcards to search for non numbers, in your example *10APN*

    Please Login or Register  to view this content.
    If 10APL comes up then I need the macro to search whatever line it found that 10APL anywhere in the soc code, search the column AM next to it, and paste that value into RPA!V whatever phone number it associated it with.

    That is the main problem with doing it the way I wrote the code above.
    If it doesn't make sense i'll keep thinking of otherways to answer the question the best I can.

  14. #14
    Registered User
    Join Date
    09-25-2015
    Location
    Arizona
    MS-Off Ver
    2010
    Posts
    8

    Re: Vba if then statement with multiple cases and wildcards

    Basically, I just need it to search for 3-4 letters in the Soc code, pull the pricing for that phone number (Feature Report Q:Q) then put the price into RPA!V5:V

+ 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: 0
    Last Post: 01-03-2014, 10:04 AM
  2. Help needed on a macro
    By del1578 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-03-2012, 03:03 AM
  3. EXCEL MACRO is attached. THIS MACRO is needed in ACCESS
    By cooldebi in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2011, 04:01 PM
  4. [SOLVED] Macro needed to set macro security in Excel to minimum
    By Carl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2006, 11:40 AM
  5. Macro needed to Paste Values and prevent Macro operation
    By thunderfoot in forum Excel General
    Replies: 1
    Last Post: 06-10-2005, 08:05 PM
  6. [SOLVED] Macro needed to Paste Values and prevent Macro operation
    By thunderfoot in forum Excel General
    Replies: 0
    Last Post: 06-10-2005, 03:05 PM
  7. [SOLVED] Macro help needed...
    By Dan E in forum Excel General
    Replies: 6
    Last Post: 01-26-2005, 08:06 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