+ Reply to Thread
Results 1 to 28 of 28

Move entire row from sheet to another based on adjacent cells contain empty cells

  1. #1
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Move entire row from sheet to another based on adjacent cells contain empty cells

    Hello
    I search for macro to move entire row from COPY sheet to MOVING sheet based on each item in column B contains empty cell for adjacent cell in column A
    so when copy to MOVING sheet should delete from COPY sheet and should update in MOVING sheet when change in COPY sheet .
    thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    Hello,

    again so confusing !

    What do you really need : a VBA procedure scanning all the worksheet at once
    or a worksheet event procedure when a cell changes in column A and is empty ?‼

  3. #3
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    Hi Marc L
    What do you really need : a VBA procedure scanning all the worksheet at once
    yes this is what I want it , but shouldn't repeat to the bottom when run the macro every time .

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    What could mean your 'but …' ?‼ As the VBA procedure is scanning all the worksheet when launched …

  5. #5
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    What could mean your 'but
    I said to shouldn't copy to the bottom for the same data have already copied . other meaning in MOVING sheet should clear data before bring them from COPY sheet.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this !


    According to the Macro Recorder a starter beginner level VBA procedure to paste only to the MOVING worksheet module :

    PHP Code: 
    Sub Macro1()
             
    UsedRange.Clear
        With Worksheet____2
    .UsedRange.Columns
            
    .Item(1).AutoFilter 1"="
          
    If Application.Subtotal(103, .Item(2)) > 1 Then
            
    .Copy [A1]
            .
    Offset(1).Delete xlShiftUp
          End 
    If
            .
    AutoFilter
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  7. #7
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    thanks !
    it shows "application defined error" in this line
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    No clue what you have badly done as it well works on my side with your attachment so back to post #6 ! …

  9. #9
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    i don't think to make mistake.
    you can see the file
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    Oh yes your bad ‼

    As it is very not the initial post attachment - try with it at least ‼ - so you forgot to update the worksheet codename reference !

  11. #11
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    so you forgot to update the worksheet codename reference !
    I'm not sure what you mean?
    if you mean 103 I don't understand what is this , I was asking about it.

  12. #12
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    No as I wrote it's the worksheet CodeName reference as the worksheets CodeNames are not the same between your both attachments ‼

    So just download your initial post attachment and try with it …

  13. #13
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    CodeNames are not the same between your both attachments ‼
    I don't understand you !
    I'm surprised from your speech . this is the same file I work at it, I downloaded the initial post attachment , still error continues !

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    You have placed the code in the wrong sheet...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  15. #15
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    As no issue on my side with your initial post attachment as it is
    And your both attachment are different, no sense to attach a workbook and to try with another one !

    Anyway I removed the pro efficient safer worksheet CodeName in this kid beginner level VBA procedure to paste to ThisWorkbook module :

    PHP Code: 
    Sub UnsafeMacro4VeryNoobBadReader()
             
    Sheets("MOVING").UsedRange.Clear
        With Sheets
    ("COPY").UsedRange
            
    .Columns(1).AutoFilter 1"="
            
    .Copy [MOVING!A1]
            .
    Offset(1).Delete xlShiftUp
            
    .AutoFilter
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 04-30-2023 at 10:52 AM. Reason: update ?

  16. #16
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    Was supposed to be...
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    thanks again
    just delete from COPY sheet without move to MOVING sheet , sorry !
    I will come back soon as I can .

  18. #18
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    @sintek
    based on Marc's code the worksheet________2 indicates to COPY sheet to filter data before copy to MOVING sheet if I'm not wrong.
    even if that just will delete from COPY sheet without show anything in MOVING sheet.

  19. #19
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    @Marc L now two both codes don't work , just delete from COPY sheet without copy to MOVING sheet!
    now what's my bad !

  20. #20
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    As my post #15 VBA demonstration well works on my side with your both attachments …

  21. #21
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    As my post #15 VBA demonstration well works on my side with your both attachments …
    Bad news for me !
    well maybe else body has alternative.
    anyway thanks for your time and try to help me

  22. #22
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    Marc L's code does work...

  23. #23
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    Marc L's code does work...
    may you attach the file work for you ,please?

  24. #24
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    file in your post 1

  25. #25
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    thanks sintek
    now I see my bad !!
    when I run the macro every time will delete data have already copied in MOVING sheet that's why I tell Marc doesn't show anything in MOVING sheet , strangely I ask from Marc L
    other meaning in MOVING sheet should clear data before bring them from COPY sheet.
    without I realize what will happen: eek:
    so I have disable this line
    Please Login or Register  to view this content.
    Last edited by abdo meghari; 05-01-2023 at 12:01 PM.

  26. #26
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    @Marc , I hope to accept my apologies !!!!
    based on post #6 your code works perfectly
    again my language of contacting is bad
    thanks very much for your help
    Last edited by abdo meghari; 05-01-2023 at 12:02 PM.

  27. #27
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move entire row from sheet to another based on adjacent cells contain empty cells


    No problemo ! But just note the codeline UsedRange.Clear is what you asked for since your post #5 ‼

  28. #28
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: Move entire row from sheet to another based on adjacent cells contain empty cells

    But just note the codeline UsedRange.Clear is what you asked for since your post #5 ‼
    yes , that's correct and I admitted in post#25

+ 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. [SOLVED] mark color for not matched items for adjacent cells based on another adjacent cells
    By tubrak in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-14-2022, 08:02 AM
  2. Macro for Merging Cells based on empty cells in same sheet
    By mattfleet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2018, 09:26 AM
  3. [SOLVED] select entire column based on activecell - multiply cells based if found empty cell
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-08-2016, 01:52 AM
  4. Replies: 0
    Last Post: 12-30-2015, 04:17 PM
  5. Replies: 1
    Last Post: 07-20-2015, 02:27 PM
  6. Replies: 3
    Last Post: 07-16-2014, 03:24 PM
  7. Replies: 0
    Last Post: 06-19-2012, 10:16 AM

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