+ Reply to Thread
Results 1 to 13 of 13

Vba Code to extract data and copy to another worksheet

  1. #1
    Registered User
    Join Date
    08-15-2021
    Location
    Saudi Arabia
    MS-Off Ver
    2016 & 365
    Posts
    26

    Vba Code to extract data and copy to another worksheet

    Hello Everyone,

    Need a vba code to extract data from worksheet name "Data" and copy to worksheet name "Report" , base on the value of "M1".
    See desired output in worksheet name "Desired Output".


    .::Thanks in advance::..
    Attached Files Attached Files
    Last edited by zelda13; 02-19-2024 at 05:40 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    307

    Re: Vba Code to extract data and copy to another worksheet

    Hello @zelda13 . You can do this using AutoFilter. Try this code:
    Please Login or Register  to view this content.
    Good Luck.
    Last edited by MikeVol; 02-19-2024 at 01:43 AM. Reason: Update
    NOTE: As the original poster/owner, only you can mark your thread as SOLVED (Thread Tools above Post #1).
    You can say "Thanks" in your thread to everyone who offered to help you.
    You can also reward them by clicking * "Add Reputation" under their username on the left.
    With Regards, MikeVol.

  3. #3
    Registered User
    Join Date
    08-15-2021
    Location
    Saudi Arabia
    MS-Off Ver
    2016 & 365
    Posts
    26

    Re: Vba Code to extract data and copy to another worksheet

    Hi @Mike

    Thank you and appreciate your help.
    May I ask you to adjust your provided code.
    It appears that the data extracted overwrite the Header in Report Worksheet.


    Thanks

    Regards
    zelda13

  4. #4
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    307

    Re: Vba Code to extract data and copy to another worksheet

    No, you are wrong that the extracted data overwrites the header in the Report Worksheet. Unless, of course, your header is on both Worksheet in the first line. This line is responsible for copying from the Data Worksheet:
    Please Login or Register  to view this content.
    , it takes the range starting from the second row after the header.
    And this line is responsible for inserting data onto the Report Worksheet:
    Please Login or Register  to view this content.
    , accordingly inserts data into the Report Worksheet starting from cell A2, second row.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Vba Code to extract data and copy to another worksheet

    Simply,
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,014

    Re: Vba Code to extract data and copy to another worksheet

    If you have O365, you can do it by formula.

    Report!A2
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-15-2021
    Location
    Saudi Arabia
    MS-Off Ver
    2016 & 365
    Posts
    26

    Re: Vba Code to extract data and copy to another worksheet

    [QUOTE=, accordingly inserts data into the Report Worksheet starting from cell A2, second row.[/QUOTE]

    @Mike

    Got it... Thank you!

    I appreciate your taking the time to write a reference for me.

    Regards
    zelda13

  8. #8
    Registered User
    Join Date
    08-15-2021
    Location
    Saudi Arabia
    MS-Off Ver
    2016 & 365
    Posts
    26

    Re: Vba Code to extract data and copy to another worksheet

    @windknife
    Thank you for providing a formula but I need a vba code.

    @jindon
    Thank you for providing the alternate code.

  9. #9
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    307

    Re: Vba Code to extract data and copy to another worksheet

    @zelda13. You're welcome and thanks for rep+
    Sorry for my English. Good luck.

  10. #10
    Registered User
    Join Date
    08-15-2021
    Location
    Saudi Arabia
    MS-Off Ver
    2016 & 365
    Posts
    26

    Re: Vba Code to extract data and copy to another worksheet

    Guys,

    Please do me a favor...I forgot to mention that column A & G are excluded in my report.
    Could you please rewrite the code that you have provided, if possible. Thanks

    Sorry for the inconvenience.
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Vba Code to extract data and copy to another worksheet

    Like this
    Please Login or Register  to view this content.

  12. #12
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    307

    Re: Vba Code to extract data and copy to another worksheet

    Untested!
    Change this line in my code:
    Please Login or Register  to view this content.
    with this:
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-15-2021
    Location
    Saudi Arabia
    MS-Off Ver
    2016 & 365
    Posts
    26

    Re: Vba Code to extract data and copy to another worksheet

    @Mike @jindon

    Thank you so much for the help.

    Regards
    zelda13

+ 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. Newbie using VBA - help with code to copy data over to another worksheet
    By jancliff in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-23-2018, 06:07 PM
  2. Replies: 13
    Last Post: 10-05-2015, 08:59 AM
  3. Copy and extract some data from each worksheet and summarize it
    By zamal264 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2012, 04:05 PM
  4. Extract Data from worksheet & copy to workbooks
    By floricita in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-14-2010, 04:58 AM
  5. Code to Copy Data From one Worksheet to Another
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-04-2008, 01:00 AM
  6. Code to Copy Data From one Worksheet to Another
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2008, 09:47 PM
  7. Re: VBA Code to Copy Data from one Worksheet to Another
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-07-2008, 04:41 AM

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