+ Reply to Thread
Results 1 to 20 of 20

auto Deleting contents of certain columns when moving rows between sheets with one click

  1. #1
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    auto Deleting contents of certain columns when moving rows between sheets with one click

    I currently have 2 sheet layers "COMPLETE" & "IN PROGRESS"

    When I change the status of a project on the "IN PROGRESS" sheet layer to 'complete' it moves the entire row to the top of the "COMPLETE" sheet layer.

    Please Login or Register  to view this content.

    I was wondering, how would I change the code so when it pastes the row onto the "COMPLETE" sheet layer, it only pastes cells from columns A:J ???

    Quick example attached with more detailed explination...


    ANY help is much appreciated!!!
    Attached Files Attached Files
    Last edited by R.Sloan; 04-17-2013 at 08:22 AM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Moving rows between sheets with one click

    solved here http://www.excelforum.com/excel-prog...et-layers.html
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Moving rows between sheets with one click

    Sloan,

    Is this thread the same as that pointed by patel45 in post 2?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: Moving rows between sheets with one click

    Sorry no this is not the same question.

    That question was asking;
    How do you automatically move a row bettween multiple sheet layers when changing the contents of one cell.

    This question is asking;
    When you automatically move a row with the code attached how would you alter it so it doesnt paste teh entire row on the second sheet, instead it needs to only paste a small range of the columns from the row that it lyes within.


    Sorry if they seem similar ive used teh same original code to work from as I know how to alter that
    The attached file is the same name but the contents and writing within detailing the problem are different.
    Last edited by R.Sloan; 04-17-2013 at 08:30 AM. Reason: worded slightly better

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Moving rows between sheets with one click

    Change this row from
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: Moving rows between sheets with one click

    Sorry patel45 this is a slightly different problem that i noticed after adding the oringal code you edited. What you did worked perfectly for the problem stated in my original question.
    This is asking, when the row is moved to the new layer i only want it to paste coloumn A:J from the row. (but to have inserted a complete row as cells K onwards will eventually need to have date inserted)

    Again though thank you for your help before, answered the question perfectly

  7. #7
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: Moving rows between sheets with one click

    Arlu1201 that is almost spot on!! it moves the row from the 1st sheet to the 2nd brilliantly

    The only problem is where it takes the oginal row from, is there any way it could delete the data remaining from cells K onwards of where the original row was taken from??

    Thank you

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Moving rows between sheets with one click

    Which is the last column from K onwards?

  9. #9
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: Moving rows between sheets with one click

    the amount of columns from K is technically infinite...but in practice probably wont be longer 100 cells
    the problem is that when it takes cells A:J over to the next sheet it leaves cells K onwards, all the date below the moves up to fill in the space where the oringal row was taken from.

    I think the oringal code i posted works well as it deletes the whole row from where the date was taken...
    is there any way to have it delete the contents of cells K onwards from the row when pasting it to the new location?

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Moving rows between sheets with one click

    Try this
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: Moving rows between sheets with one click

    no luck im affraid,
    it deletes the row when i write in any cell...
    when i click to move the row to the next sheet it says there is a bug and returns to the view code page :S
    sorry. thank you for trying though

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    When you get an error, which line is highlighted?

  13. #13
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Moving rows between sheets with one click

    Since i have already given you the clear contents code, remove this line of code
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    Hi arlu, i just tried removing the
    .delete line and the same errors occur.

    Range(Cells(Target.Row, 11), Cells(Target.Row, lcol)).ClearContents highlighted yellow...

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    Which is the error?

  16. #16
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    when i click to debug it highlight;

    Please Login or Register  to view this content.
    as being the yellow, i have no idea HOW to code so i dont know if it makes any different to say that it was highlighted in yellow.

    again, thank you for the persistence, it's much appreciated.

  17. #17
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    When the yellow line is present, if you hover your mouse over target.row, what value do you see?

    Also whats the error number and description?

  18. #18
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    Please Login or Register  to view this content.
    I'm extremely new to coding so dont know if it helps to say it was highlighted yellow...

  19. #19
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    What is the name of the error?

  20. #20
    Registered User
    Join Date
    04-02-2013
    Location
    england
    MS-Off Ver
    Excel 2016
    Posts
    53

    Re: auto Deleting contents of certain columns when moving rows between sheets with one cli

    Hi Arulu1201, sorry didnt see this post now went onto a second page!!!
    using a couple of lines from your code you wrote i just slipped them into the old code, i think it works fine now. it just clears the cells of the target line before copying the row over.

    Please Login or Register  to view this content.
    seems to work ok, going to test a little more.
    Thank you for your help the clearcontents line was bang on what I needed

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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