+ Reply to Thread
Results 1 to 12 of 12

-how to use VBA to search strings and return values or cells nearby

  1. #1
    Registered User
    Join Date
    05-20-2009
    Location
    Wollongong,Australia
    MS-Off Ver
    Excel Vista
    Posts
    7

    -how to use VBA to search strings and return values or cells nearby

    So, think your hot stuff.

    Im needing to search through the attached document which is truck logs at a mine and use vba to search through the list for each of the different shovels eg SHVL1, SHVL2 & SHVL3, and when the code finds that string, to display the tonnage 2 colums back from it. Im about half way there a i think but am having trouble with strings, if it was numbers i could do it no problem

    I have the idea in my head but need a genius to help me with the fine print

    Heres what i have so far (that doesn't work) but it gives an idea of what i want

    Please Login or Register  to view this content.
    Hopefully someone konws what to do here..or has done it before
    Thanks
    Dan
    Attached Files Attached Files
    Last edited by DonkeyOte; 05-20-2009 at 03:37 AM.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    re: -how to use VBA to search strings and return values or cells nearby

    You can solve with Sumif function. See attached file.

    Regards,
    Antonio

  3. #3
    Registered User
    Join Date
    05-20-2009
    Location
    Wollongong,Australia
    MS-Off Ver
    Excel Vista
    Posts
    7

    Re: -how to use VBA to search strings and return values or cells nearby

    lol.

    you mean

    Please Login or Register  to view this content.

    I figured sub and end sub gave it away?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: -how to use VBA to search strings and return values or cells nearby

    Yes but we meant revise your original post... given you went to the effort of re-posting with tags I edited your first post.

    Please be sure to read the Rules - they are for everyone's benefit to ensure things run as smoothly as possible. Often, VBA within tags is much easier to follow / analyse ...

  5. #5
    Registered User
    Join Date
    05-20-2009
    Location
    Wollongong,Australia
    MS-Off Ver
    Excel Vista
    Posts
    7

    Re: -how to use VBA to search strings and return values or cells nearby

    ok no problem, thanks. I see *sumif* but no attached file?

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: -how to use VBA to search strings and return values or cells nearby

    Yes, I've PM'd antoka05 and asked them to reload... I appear to have removed the original (my bad)

  7. #7
    Registered User
    Join Date
    05-20-2009
    Location
    Wollongong,Australia
    MS-Off Ver
    Excel Vista
    Posts
    7

    Re: -how to use VBA to search strings and return values or cells nearby

    no problem, ill upload the final copy once i finish it.
    Thanks
    Dan

  8. #8
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: -how to use VBA to search strings and return values or cells nearby

    I am sorry... I missed attachment in my previous answer.

    Regards,
    Antonio
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-20-2009
    Location
    Wollongong,Australia
    MS-Off Ver
    Excel Vista
    Posts
    7

    Re: -how to use VBA to search strings and return values or cells nearby

    thats awesome, your a champion... just out of curiousity, do you know how to do it in VBA?

  10. #10
    Registered User
    Join Date
    05-20-2009
    Location
    Wollongong,Australia
    MS-Off Ver
    Excel Vista
    Posts
    7

    Re: -how to use VBA to search strings and return values or cells nearby

    only because it is going to be part of a larger chunk of code

  11. #11
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: -how to use VBA to search strings and return values or cells nearby

    You can use SumIf function:
    Please Login or Register  to view this content.
    or simply:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  12. #12
    Registered User
    Join Date
    05-20-2009
    Location
    Wollongong,Australia
    MS-Off Ver
    Excel Vista
    Posts
    7

    Re: -how to use VBA to search strings and return values or cells nearby

    thanks a lot. quite knowledgable website.

+ 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