+ Reply to Thread
Results 1 to 9 of 9

If status shows open, Data to be copied over to new sheet

  1. #1
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    If status shows open, Data to be copied over to new sheet

    Hi

    I need some help on the attached file to copy over 7 columns which are highlighted in green to sheet2 if the status in column P in sheet1 is "open". The items that are copied over needs to be sorted from earliest date based on column B date/time created. If the record in sheet1 has changed from open to any other status, the item in sheet2 needs to be removed. I have placed some samples in sheet2 for expected results
    Attached Files Attached Files

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: If status shows open, Data to be copied over to new sheet

    Your sample does not match your narrative. Which do you want to go by? There are more than seven columns highlighted in green. The column you want to sort on is not included in the Sheet 2 sample. Please clarify.
    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". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    Re: If status shows open, Data to be copied over to new sheet

    Hi JLGWhiz,

    I've indicated the columns that are to be copied over below. Items that are listed as status open in Sheet1, column P will have the below data copied over. For sorting it will use sheet2, column B from earliest date/Time created. Apologies for not putting it in detail.

    Sheet1, Column B will be copied over to Sheet2, Column D
    Sheet1, Column C will be copied over to Sheet2, Column A
    Sheet1, Column D will be copied over to Sheet2, Column B
    Sheet1, Column O will be copied over to Sheet2, Column C
    Sheet1, Column G will be copied over to Sheet2, Column E
    Sheet1, Column R will be copied over to Sheet2, Column F
    Sheet1, Column S will be copied over to Sheet2, Column G
    Attached Files Attached Files

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: If status shows open, Data to be copied over to new sheet

    To eliminate any items which might have had the status change since the last update, the macro starts by clearing all the old data. That way, only currently open items will appear on the sheet 2 data. I will leave the sorting to you since your format appears to containg merged cells.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: If status shows open, Data to be copied over to new sheet

    If post #4 satisfied your issue, you should mark the thread as "Solved" using the 'Thread Tools' button' near the top of the window.

  6. #6
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    Re: If status shows open, Data to be copied over to new sheet

    Thank you very much.

    To learn about the code, Can i also check if the section here is reflecting the condition that if status is shown as "Open" the data gets copied over over. How can i amend the condition to be instead of "open", it will if there are any text entered in this same column P, data gets copied.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: If status shows open, Data to be copied over to new sheet

    Change to:

    Please Login or Register  to view this content.
    It will filter on any value in column 16.

    When copying filtered data with VBA, the 'SpecialCells(xlCellTypeVisible)' method needs to be used so the rows hidden by the filter will not be copied also. The code in post #4 used several copy actions because the ranges being copied were erratic between the copy and paste positions and could not be copied as a group. The Offset method was used to position the pasted values so they would maintain the integrity of their original relationship on each copied row.

  8. #8
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    Re: If status shows open, Data to be copied over to new sheet

    Got it. Thank you for assisting me to understand how it works.

  9. #9
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: If status shows open, Data to be copied over to new sheet

    Quote Originally Posted by michael35 View Post
    Got it. Thank you for assisting me to understand how it works.
    You're welcome,
    Regards, JLG

+ 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: 1
    Last Post: 07-20-2017, 07:53 AM
  2. Replies: 6
    Last Post: 01-30-2017, 03:07 PM
  3. File shows 1GB data, but unable to open same
    By vinistring in forum Excel General
    Replies: 6
    Last Post: 09-22-2015, 04:06 PM
  4. Replies: 4
    Last Post: 04-05-2015, 01:59 AM
  5. Replies: 2
    Last Post: 01-01-2015, 09:38 PM
  6. Replies: 1
    Last Post: 01-14-2014, 04:18 PM
  7. cell shows status based on multiple IF statements????
    By jonnywakey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-16-2012, 04:26 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