+ Reply to Thread
Results 1 to 12 of 12

Tinkering Macro Code

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Tinkering Macro Code

    Something in my code needs to be changed. I have data in columns A-H but my target value is in column F, so once that value is met, it transfers the line to another sheet (which is what I am looking to do) but it ignores the G & H column entries. Anyone know of a tweak I can throw in so that I can continue to edit the line values after the transfer is done? Please see the code below.

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Tinkering Macro Code

    Would this work?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Tinkering Macro Code

    I pasted the cod in place of the other. Unfortunatly it does not allow me to continue editing the fields after the copy has been done.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Tinkering Macro Code

    Hi Erusso,

    Could you explain ignores.

    What part of the code is ignoring G&H?

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Tinkering Macro Code

    What fields do you want to edit? It would be easier to help if we can see your file. Could you post it?

  6. #6
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Tinkering Macro Code

    If I fill out the line this way (a,b,c,d,e,g,h, then finish with f) I get all the data. but if I go from a-h it does the copy to another sheet at f and from that point on I can no longer add to the copy from the original sheet (sheet2).

    Normally I would just fill it out in that order, but multiple users will be using this.

    Thanks,

    ER

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Tinkering Macro Code

    That happens because your target range is column F. That means that as soon as you enter data in any cell in column F, the copy is made as soon as you exit that cell, so any data you enter in columns G and H will not be copied because the copy was done at column F. What you might want to do is enter a modifed code in a regular module instead of a worksheet and then run the macro after you have finished entering your data in all the columns.

  8. #8
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Tinkering Macro Code

    Row F data transfer.xlsm

    Here is a sample file that shows the problem.

    Thanks again

    ER

  9. #9
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Tinkering Macro Code

    @Mumps1:
    The data will be continuously added. There will be no moment where the database is complete. That's why I need some sore of coding that will allow me to edit after the copy has been made.

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Tinkering Macro Code

    Try the attached file. Enter all your data and then click the button.
    Attached Files Attached Files

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Tinkering Macro Code

    Hi Erusso. I forgot to mention that the code in file I attached will copy all the rows at once after you finish entering all your data. Unfortunately, the next time you click the button, it will copy the same rows again. This may not be what you want. One simple solution would be to use the code i posted earlier in your worksheet but move column F to the end so that it is the last column. This way all the data will be copied when you complete column F. Have a look at the attached file and see if this will work for you.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Tinkering Macro Code

    OK Thank you!

    Anyone know of any changes that I can make to the code so that I dont have to move the column? Or is that the only option? How about something like this -If Target.Value = "BRING FORWARD / À REVOIR" AND column H has any sort of entry (there will ALWAYS be an entry in H) THEN copy to the other sheet. would that work?

    ER

+ 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