Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VBA question

  • 20-02-2011 05:03PM
    #1
    Registered Users, Registered Users 2 Posts: 98 ✭✭


    Hi Folks,

    Im pretty new to VBA with excel and was wondering if some one could point me in the right direction.

    I've got a workbook with 2 sheets, lets say A and B.

    B contains customer details
    A contains customer orders.

    I need to extract details from A based on each custome in B.

    Its pretty straight forward im just a bit stuck on how to do it in VBA.

    I think the code should look something like the following.

    Select into TableB all records in B,
    Select into TableA all records in A

    For each record in TableB loop,
    clear custdetails
    Select into custorders all records in A
    Where TableB-custID equals tableA->custID.
    perform action with custdetails
    end loop

    any help appreciated.

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 2,088 ✭✭✭henryporter


    I'm not quite following what you're trying to do here - you want to loop through table B to find corresponding records in table A and do what with the results?


  • Registered Users, Registered Users 2 Posts: 98 ✭✭gerryg80


    I'm not quite following what you're trying to do here - you want to loop through table B to find corresponding records in table A and do what with the results?

    Thanks for the reply

    with the results, i intend on creating a new spreadsheet and automatically email the results to the customer. (this bit i have sorted/working).


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    use a database instead of excel:D


  • Closed Accounts Posts: 18,053 ✭✭✭✭BostonB


    amen wrote: »
    use a database instead of excel:D

    +1

    Dunno why you are doing this in Excel.


  • Registered Users, Registered Users 2 Posts: 98 ✭✭gerryg80


    BostonB wrote: »
    +1

    Dunno why you are doing this in Excel.

    thanks for the advice, ill take it under consideration


  • Advertisement
  • Closed Accounts Posts: 18,053 ✭✭✭✭BostonB


    Maybe you've a reason that you've not mentioned here.


Advertisement