+ Reply to Thread
Results 1 to 17 of 17

Macro for exporting data out of different sheet

  1. #1
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19

    Macro for exporting data out of different sheet

    Hello,

    I need help! I need a macro which uses 2 sheets. I have a value in Sheet1("F30") which then needs to be found in Sheet2("A:A") i then need it to copy the selection along that row which would be ("B/row number , I/same row number")
    I cant use copy entire row. I then need the selected copy to paste back into Sheet1 but the location would be ("G30 , N30")

    Forgot to mention, This is done using a button and the value is written in.

    If anyone can help that would be great if I am missing any information that you might need I am happy to try supply it

    Many thanks
    Liam

  2. #2
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    Hi Liam,
    Trust you're doing well.
    Would it be possible to attach a sample file so we can check it out and provide some help?
    Cheers,
    Filipe


    * If a reply solved or answered your query/question, you can add reputation to the person by clicking on the * Add Reputation
    * When question is resolved, please mark your thread as SOLVED


    Thanks and regards,
    Filipe Oliveira

  3. #3
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19
    Here is a sample, i have had to rip a few things from it though im afraid
    Attached Files Attached Files

  4. #4
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    Hi Liam,
    Check the attached file.
    I have created a named range in equipment monitor sheet and added a code in the Export button to perform a lookup and add it in the required cells.
    Please let me know if that's what you're looking for.
    Best regards,
    Filipe
    Attached Files Attached Files

  5. #5
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    Sorry Liam,
    Check the one attached here.
    I added a bit more code that displays a message box in case the EQ Number does not exist in the Equipment Monitor Table.
    Cheers,
    Filipe
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Macro for exporting data out of different sheet

    Hi Filipe,

    This is amazing thank you so much! I like the touch for a warning for if the EQ part doesnt exist

    Many thanks
    Liam

  7. #7
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    You're welcome Liam.
    Let me know if you need explanation on the written code.
    If you don't need more assistance, please set this thread to Solved under Thread Tools.
    Best regards,
    Filipe

  8. #8
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Macro for exporting data out of different sheet

    If you can give an explanation i would appreciate it.

    From what I can understand it is using the range EQ Number for titles and then locating the required EQ value after that its just importing the rest of the row into the required area

    Is that close?

    Regards
    Liam

  9. #9
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    Yes Liam,
    First thing I did was setting a Named Range in Equipment Monitor sheet under the name "EQ_Number". I set the range as "A2:I1000" (You can change this if you're going to have more records in the future).
    Then, in Module4 I have added the code (Under name Export_EQ_Value) as explained here:
    Please Login or Register  to view this content.
    Then just assigned this code to the Export button in Main Menu sheet.
    Let me know if you need further assistance.
    Best regards,
    Filipe

  10. #10
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Macro for exporting data out of different sheet

    Okay so I am slowly learning which is great to know!

    So how would I go about re importing the line back in to update the information? Also is there a way to recognize the department in H30 so it can also find the same EQ value and update the information there as well?

    Regards
    Liam

  11. #11
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Macro for exporting data out of different sheet

    I was thinking if i get it correctly with a new button I could essentially reverse what you have written so that it will then find it and then copy the main menu to the equipment list. after it reads H30 and follows the same procedure as it did for copying it into the equipment list. Would this require more ranges? Or can i successfully say I am going along the right tracks?

    Regards
    Liam

  12. #12
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    If you want to be able to update information within a EQ Number, I would suggest using a UserForm for it so it can copy the info to the Main Menu and/or update new info of that EQ to Equipment Number.
    This can also be done for H30.

  13. #13
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    You can also,
    On the code, just swap from this
    Please Login or Register  to view this content.
    To this:
    Please Login or Register  to view this content.
    Need to try out to see if that really works but I think so.
    Cheers,
    Filipe

  14. #14
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Macro for exporting data out of different sheet

    Hi Filipe,

    I tried it out but comes up with wanting an expression at the end of the code line where it says .Value = 'Equipment Name

    Does the code essentially reverse the export by importing it back into the same area as where it was taken from?

    Regards
    Liam

  15. #15
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    Hey Liam,
    Let me have a look and I'll get back to you.
    Cheers,
    Filipe

  16. #16
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Macro for exporting data out of different sheet

    Hi Liam,
    Copy-Paste this code on a Module or even below the code I've made previously, then assign the macro to a button (Maybe name it as "Update Info" or something).
    Please Login or Register  to view this content.
    If you change data in Main Menu, running the Macro it will update the info in the "Equipment Monitor Sheet".
    The code is a little more complex than previous one.
    Let me know if that works.
    Cheers,
    Filipe
    Last edited by pipoliveira; 02-20-2020 at 07:30 AM.

  17. #17
    Registered User
    Join Date
    01-17-2020
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Macro for exporting data out of different sheet

    Hi Filipe,

    Thank you so so much for your help! This is the last little push I needed

    Many thanks
    Liam

+ 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: 10-19-2016, 11:37 AM
  2. Exporting Client Sheet into CVS via Macro
    By stephenorgan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2014, 09:09 PM
  3. Exporting data to another sheet
    By nooredein in forum Excel General
    Replies: 1
    Last Post: 05-06-2014, 03:04 PM
  4. Replies: 5
    Last Post: 08-31-2013, 03:21 AM
  5. Exporting sheet as *.txt - Exclude Quotes Macro
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2010, 07:55 AM
  6. Exporting excel sheet+macro to HTML
    By prtyagi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2008, 02:30 AM
  7. Replies: 1
    Last Post: 07-20-2006, 08:55 AM

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