+ Reply to Thread
Results 1 to 7 of 7

Search for unique numbers and copy thier specific data to another sheet in excel VBA code

  1. #1
    Forum Contributor
    Join Date
    08-10-2016
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    242

    Search for unique numbers and copy thier specific data to another sheet in excel VBA code

    I have a workbook which has three sheets.

    On Second Sheet named "Grade Wise" i have raw data. I want to create a button on 3rd Sheet named "Sheet1" which will copy data from 2nd sheet to 3rd sheet.

    On 2nd sheet which has raw data, in column A and B data is repeated due to fact that these farmers have provided different grades with different weights.

    Now the challenge here is i want to copy unique Farmer numbers and names (of column A and Column B) data for each farmers to 3rd sheet (As shown in attached picture).

    In 2nd sheet, Column C has different grades, whose starting alphabets are X,C,M,B and their third alphabets includes A,F,C also.

    CHALLENGE 1: Now, i want to copy sum of all X to X (on 3rd sheet column D), sum of all C to C(on 3rd sheet Column E), sum of all M to M (on 3rd sheet Column F) and sum of all B to B (on 3rd sheet Column G) for each unique number--As Shown In Attached Picture.

    (VBA CODE IS WRITTEN FOR THIS CHALLENGE AND IS WORKING PROPERLY BUT I WANT TO ADD BELOW OPERATIONS TO THE VBA CODE) SHEET SAMPLE IS ATTACHED

    CHALLENGE 2:It should also look for third alphabet(A,F,C) and copy their Sum of all A to A (on 3rd sheet column N), Sum of all F to F (on 3rd sheet column O), Sum of all C to C (on 3rd sheet column P) as shown in attached pictures I need VBA code for this operations please help me. :Untitled-1.png
    Attached Files Attached Files
    Last edited by Zahid0111; 03-11-2020 at 10:47 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Search for unique numbers and copy thier specific data to another sheet in excel VBA c

    If I understood you correctly replace the main procedure code.
    Please Login or Register  to view this content.
    Best Regards,
    Maras.

  3. #3
    Forum Contributor
    Join Date
    08-10-2016
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    242

    Re: Search for unique numbers and copy thier specific data to another sheet in excel VBA c

    Okay great..sure i am going to try this...

  4. #4
    Forum Contributor
    Join Date
    08-10-2016
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    242

    Re: Search for unique numbers and copy thier specific data to another sheet in excel VBA c

    Hi it,s working fine...Thank you so much.Please help me in importing this data to another sheet...
    I have inserted a button named "Import Data" in my Dashboard. The purpose of this button is that when i click this button it should bring the import/Browse/Select file window by using command "Application.GetOpenFilename(Title:="Browse for File & Import", FileFilter:="Excel Files (*.xls*),*xls*")".User will select a file and it should search/look for Sheet named "Grade Wise"and copy all data (from column A to column E). This data to be pasted in dashboard workbook(where we have inserted the import button).It will search for Sheet named"RawData" and paste data in last blank row(Column A to Column E). and Then the code which you have sent to me today to be executed in the same sheet and separate all the values/alphabets accordingly and paste them in RawData sheet from column H to X. Attached are the workbooks.PLEASE HELP ME IN THIS
    Attachment 666663Attachment 666664Attachment 666665
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    08-10-2016
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    242

    Re: Search for unique numbers and copy thier specific data to another sheet in excel VBA c

    Hi maras_mak, Can you please help me with adding below operation to the code:
    It should also look for third alphabet(K,G) and copy their Sum of all K to K (on 3rd sheet column R), Sum of all G to G (on 3rd sheet column S).
    Same as you did for A,F,C which are third alphabets, now i want to add K & G also to the code
    Please help me adding this too

  6. #6
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Search for unique numbers and copy thier specific data to another sheet in excel VBA c

    You must enter your access path in the code - here

    .InitialFileName = "your access path" ' e.g. "c: \ Users \ User \ Downloads \ Temp1 \".

    Each time the 'Import data' button is used, the data A-E and H-X will be deleted.

    Solution in the attachment.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    08-10-2016
    Location
    Pakistan
    MS-Off Ver
    365
    Posts
    242

    Re: Search for unique numbers and copy thier specific data to another sheet in excel VBA c

    Great..Thank you so much for thee help...

+ 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. vba code for copy specific data to another sheet
    By rishikrsaw in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-07-2017, 05:01 AM
  2. [SOLVED] Vba code to copy unique email id data from input sheet to output sheet
    By UPA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-09-2017, 07:19 AM
  3. Replies: 4
    Last Post: 05-16-2014, 06:30 AM
  4. VBA code to select all data then copy and paste all unique value to another sheet
    By ahs004 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2013, 09:07 AM
  5. Macro to search sheet for certain criteria and copy specific data to cell
    By ThaGonz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2012, 12:34 PM
  6. Replies: 11
    Last Post: 11-23-2011, 04:39 AM
  7. Replies: 0
    Last Post: 11-19-2009, 09:20 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