+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 15 of 48

Code to Pull Records From 2 Other Sheets

  1. #1
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87

    Code to Pull Records From 2 Other Sheets

    Hello,

    Can someone come up with code to fill in cells from 2 other sheets('AFRsDB' & 'AFRsParts') based on cell F2 on my 'AFRsInput' sheet.

    Thank you in advance for your help,
    FF
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    10-06-2007
    Location
    UK
    MS-Off Ver
    Excel 2016
    Posts
    10

    Re: Code to Pull Records From 2 Other Sheets

    Hi - I have taken a look.

    Its unclear exactly what you are trying to achieve, however it does look like you can achieve what you need with if statements and vlookups.

    Can you be more descriptive on what you need.

    Cheers
    Scar1

  3. #3
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87

    Re: Code to Pull Records From 2 Other Sheets

    I think I will need a macro to do this since the sheet will be for entry also thank you.

  4. #4
    Registered User
    Join Date
    10-06-2007
    Location
    UK
    MS-Off Ver
    Excel 2016
    Posts
    10

    Re: Code to Pull Records From 2 Other Sheets

    Are you pulling information based on the dropdown F2 value?

  5. #5
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87

    Re: Code to Pull Records From 2 Other Sheets

    Yes if you see the orange shape below with text information.

  6. #6
    Forum Contributor
    Join Date
    01-07-2013
    Location
    Michigan
    MS-Off Ver
    O365
    Posts
    164

    Re: Code to Pull Records From 2 Other Sheets

    You can pull data into the form without a macro, if that's all it is used for. However, if you're using the same form to add data to the other two tabs, you'll need VBA to retrieve records.

  7. #7
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87

    Re: Code to Pull Records From 2 Other Sheets

    Yes it will be for entering data also. Thank you

  8. #8
    Valued Forum Contributor
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    1,136

    Re: Code to Pull Records From 2 Other Sheets

    The first procedure goes in the worksheet code module for Sheet AFRsInput.

    The second procedure goes in the standard code module1.

    When an entry is made in cell F2 it will trigger the first macro which then calls the second procedure. If the entry is valid the second procedure will fill in the data on the input sheet. If the entry is not valid, a message will appear and the procedure will terminate.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved".

  9. #9
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87

    Re: Code to Pull Records From 2 Other Sheets

    I get error by trying this sorry.
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    1,136

    Re: Code to Pull Records From 2 Other Sheets

    The code is performing as it should. The problem is an anomoally in the worksheet that is causing vba to detect a merged cell condition. I tried running some routines to elimiunate any merged cells in the applicable ranges but that did not cure the problem and I cannot find where the cuprit is residing. Merged cells and vba don't mix well although it can usually be worked around. In this case, it is beyond my technical skills to locate and fix the cause of the code interruption. Sorry. Maybe someone else can come up with an idea that will work.
    Regards, JLG

  11. #11
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87
    Thanks for your efforts.
    Last edited by AliGW; 03-16-2019 at 07:03 AM.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Excel 2016 (Win 10 - Work) & 365 Subscription (Win 10 - Home)
    Posts
    23,685

    Re: Code to Pull Records From 2 Other Sheets

    To draw attention back to this thread, you should bump it by posting again to it. Please do NOT open new threads directing members to look at another thread of yours. The thread you opened to do this has been deleted. Thank you for your co-operation.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    STOP PRESS: Forum Rules Updated September 2018! Please read them here.
    Are you new to Power Query and don't know what to do with the code you've been given? Have a look here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  13. #13
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87

    Re: Code to Pull Records From 2 Other Sheets

    My apologies how do I bump it please? I will cooperate as you wish.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Excel 2016 (Win 10 - Work) & 365 Subscription (Win 10 - Home)
    Posts
    23,685

    Re: Code to Pull Records From 2 Other Sheets

    You just have - as I said, you just need to post to the thread again. However, we don't expect you to do this too soon - if a day has elapsed since the last post to your thread, it's fine to bump.

  15. #15
    Registered User
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    87

    Re: Code to Pull Records From 2 Other Sheets

    I thought by having replies at first asking questions that I thought I mentioned in the original post lessons my chances of getting actual help. My fault for assuming. Have a wonderful day!

+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast

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