+ Reply to Thread
Results 1 to 6 of 6

Need to copy a row from Sheet1 to Sheet2 then auto delete from Sheet 1 based on Column G

Hybrid View

jingles9 Need to copy a row from... 10-16-2015, 02:21 PM
mehmetcik Re: Need to copy a row from... 10-16-2015, 02:35 PM
jingles9 Re: Need to copy a row from... 10-16-2015, 03:20 PM
mehmetcik Re: Need to copy a row from... 10-16-2015, 04:13 PM
jingles9 Re: Need to copy a row from... 10-17-2015, 08:40 PM
jingles9 Re: Need to copy a row from... 10-20-2015, 08:11 AM
  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    Need to copy a row from Sheet1 to Sheet2 then auto delete from Sheet 1 based on Column G

    Hello Everyone,
    I have an excel spreadsheet (Excel 2007). I need to copy the entire row from the Sheet labelled "Master" based on the comment placed in column G labelled "Status". If the comment states "Closed", I want the entire row to be transferred to the sheet labelled "Closed" and then the original row from the "Master" to automatically delete.
    Currently my excel file will transfer the information as required but it will not delete it from the "Master" tab. On the sample it is Row 8 on the "Master" tab that I want to have auto delete.
    Does anyone know how I can do this? Any help is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need to copy a row from Sheet1 to Sheet2 then auto delete from Sheet 1 based on Column

    I would use two macros to do this.

    The first sheet specific would look for the word closed and run the second macro.

    Right click on the sheet name at the bottom of excel and select view code

    paste this code there and close the window.


    
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Or Target.Column <> 7 Or InStr(LCase(Target.Value), "closed") = 0 Then Exit Sub
    Closed (Target.Row)
    End Sub
    Put this second Macro into a standard Macro Module.

    
    Sub Closed(MyRow As Integer)
    Application.EnableEvents = False
    
    With Sheets("Closed")
        .Range("A2:H2").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    End With
    
        Sheets("Master").Range("A" & MyRow & ":H" & MyRow).Copy Destination:=Sheets("Closed").Range("A2")
        Sheets("Master").Range("A" & MyRow & ":H" & MyRow).Delete Shift:=xlUp
    Application.EnableEvents = True
    End Sub
    Attached Files Attached Files
    Last edited by mehmetcik; 10-16-2015 at 04:13 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Need to copy a row from Sheet1 to Sheet2 then auto delete from Sheet 1 based on Column

    Hi Mehmetcik...thanks for the quick reply. I tried to follow your instructions but I cannot get it to work. I deleted the IFERROR formulas on the "Closed" tab, but that didn't seem to work either. I also noticed there was coding in Module 1 which I no longer needed so I deleted that as well. Any suggestions on what I may be doing wrong? Thanks again for looking at this.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need to copy a row from Sheet1 to Sheet2 then auto delete from Sheet 1 based on Column

    Sample Attached.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Need to copy a row from Sheet1 to Sheet2 then auto delete from Sheet 1 based on Column

    Works perfectly....thanks so much

  6. #6
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Need to copy a row from Sheet1 to Sheet2 then auto delete from Sheet 1 based on Column

    One last question....Currently I have coding on the first tab that will auto sort the sheet once it is activated (select closed tab and then go back). I tried pasting this coding on the "Closed" sheet as well but it didn't work. I also tried pasting it into the "Worksheet" coding but still no luck. Is there a way to have the "Closed" sheet auto sort alphabetically by Column A as well?

+ 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. copy sheet 2 data as it is in sheet3 if column "B" matches in sheet1 & Sheet2
    By shloksurya in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2015, 09:35 PM
  2. Need a macro to delete data on sheet2, copy data from sheet1 to sheet2
    By noorie007 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2014, 02:32 PM
  3. [SOLVED] copy data from sheet1 to sheet2 based on column (A) sheet1 and column (C) sheet2
    By AWITCHER in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-13-2014, 03:20 PM
  4. Insert/Delete record in Sheet2 based on cell value in Sheet1
    By nseethar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2014, 02:29 AM
  5. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  6. Copy certain data from Sheet1 to Sheet 2 based on values in a column on Sheet1
    By theglitch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2013, 01:28 PM
  7. [SOLVED] Copy and Paste Entire Row from Sheet1->Sheet2 based on text string match in Sheet1 Row
    By dmlovic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2012, 08:42 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