+ Reply to Thread
Results 1 to 11 of 11

Copy , Sort & Compute multiple columns using excel macro

  1. #1
    Registered User
    Join Date
    08-25-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    4

    Copy , Sort & Compute multiple columns using excel macro

    Dear Members - I am new to excel Macros and require a small help for creating a macro for the below requirement -

    1) I have set of raw data in sheet1 (refer attached sheet) .
    2) Using a macro i need to

    a) copy some columns from Sheet 1 to Sheet 2 - Ship number , shipment , month , Urgency & days (keeping sheet1 formatting)
    b) In sheet 2 compute a new column (estimated delivery date) which will be sum of today's date + days
    c) Order sheet 2 by Month & urgency desc
    d) macro should stop when it reaches an empty line in Sheet 1

    Hope experts in this forum can help me out here .

    Many Thanks
    Attached Files Attached Files
    Last edited by j1nx007; 08-25-2018 at 05:31 PM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Excel Macro programming help

    Sheet2 is always a new sheet or do you want to paste data at the bottom just after "old" info ??
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    08-25-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    4

    Re: Excel Macro programming help

    Hi PCI -

    Sheet 2 is an existing sheet , when the macro is run it should delete old content in sheet 2 and replace it with new values ..is this possible?

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Copy , Sort & Compute multiple columns using excel macro

    Title more explicit now
    See next code
    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,795

    Re: Copy , Sort & Compute multiple columns using excel macro

    Another option
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-25-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    4

    Re: Copy , Sort & Compute multiple columns using excel macro

    Hi PCI & Fluff13 - many thanks for your reply , they have helped me a lot in progressing my requirements and also helped me improve my knowdlege on macros - being sunday today i have not be able to apply the macros to the original spreadee...but it does work on the test data .

    Fluff 13 - the solution that you have provided , is it possible to incorporate the below change -

    1) Instead of copying the entire sheet 1 to sheet 2 and then deleting the columns that are not required - is it possile to just select and paste only the columns that are required to sheet 2? reason being the orginal spreadsheet had around 50+ columns in it and it will become messy to copy and delete so many coloumns that are not required in sheet2. If this is not possible or difficult then the existing delete solution does work fine .

    2) Is it possible to apply a filter and copy only the data that have Shipment = Japan , Mongolia , US , Russia to sheet 2?
    3) In sheet 2 is it possible to paste the data from row 3 onwards - leaving the 1st two rows of sheet 2 empty as i wanted to place a text box with the link to run the macro in sheet 2?

    Many thanks again ... the solutions that you have supplied have already helped me a lot . thanks again .
    Last edited by j1nx007; 08-26-2018 at 06:37 AM.

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

    Re: Copy , Sort & Compute multiple columns using excel macro

    See if you can adjust the code to your actual workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,795

    Re: Copy , Sort & Compute multiple columns using excel macro

    How about
    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Copy , Sort & Compute multiple columns using excel macro

    Give a chance to next code.
    Thx to Fulff13 and Jindon, I reused some of their statements: No shame to copy when it is good ... !
    Note: In column "C" do you want to sort by month number or month name ??

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-25-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    4

    Re: Copy , Sort & Compute multiple columns using excel macro

    Hi PCI , Jindon & Fluff13 - many thanks for your suggestion on this post . each of your suggesstions have helped me in improving my understanding of macros and fulfill the requirements for my reporting problem .

    PCI - wanted to order sheet2 based on month name .

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,795

    Re: Copy , Sort & Compute multiple columns using excel macro

    Glad we could help & thanks for the feedback

+ 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. Want to Become Expert in Macro and VBA Programming in Excel
    By VIJEXCEL in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2014, 12:00 PM
  2. clarification need for Excel Macro programming
    By padmaja_n in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-07-2007, 09:58 AM
  3. HELP: excel macro programming woes.... :S
    By KevinGPO in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2006, 12:10 AM
  4. HELP: excel macro programming woes.... :S
    By KevinGPO in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-22-2006, 12:10 AM
  5. [SOLVED] Excel Macro Programming
    By Marvin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2005, 11:05 AM
  6. Macro Programming in Excel 2003
    By mick the quick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2005, 01:06 PM
  7. [SOLVED] Macro programming in Excel
    By CarlosD_LongIsland in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-30-2005, 02:06 PM

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