+ Reply to Thread
Results 1 to 14 of 14

Copying from one sheet to another with complication

  1. #1
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Copying from one sheet to another with complication

    Hi,

    I am hoping this will be a nice easy fix but I don't have the knowledge to complete it.

    I have a form which I would like users to update and then be able to click a button and update a database. The form is on Sheet 1 cells B4 to Z5 (First row headers, second row data) and I would like when they press the button the macro would look up the value in cell E5 in column C of the other sheet (Sheet 2) and find where it is present. Then it would copy the entire data from Sheet 1 and replace the whole line on Sheet 2 (i.e. Sheet 1 B5 - Z5 into Sheet 2 A(whatever row the value in cell E5 of sheet 1 relates to) to Z (whatever row the value in cell E5 of sheet 1 relates to)

    Hopefully makes sense and I can sort of follow some of the stages but hoping someone can just show me the code I would need to achieve the above?

    Many thanks,
    Tony

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Copying from one sheet to another with complication

    Could we see the workbook?

    BSB

  3. #3
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copying from one sheet to another with complication

    Hi BSB,

    Sorry for the delay - here is a version of the file
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copying from one sheet to another with complication

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copying from one sheet to another with complication

    Thanks John, this almost works exactly as I need - my only extra bit is there are going to be some cells that have formula in them that I would like to copy over as well.

    When I use this macro is seems to just copy absolute numbers instead of formula?

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copying from one sheet to another with complication

    Try:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copying from one sheet to another with complication

    Hi John,

    Thank you for this it has worked exactly as I was hoping.

    Forgive me for asking lots of questions but I have an extra requirement that I'm hoping you can help with? This process works fine for when I want to edit an existing record but sometimes we want to add new records as well. I am going to have a separate form for people to add new records (mainly because this is easier for the teams to understand more than anything)

    In the new form all the structure would still be the same except instead of finding the existing jobs number as the code does below I would just like it to find the first empty row on Sheet 2 and copy all the information over from 'Sheet3' for want of a better sheet name. I'm struggling at finding a way to get Excel to select the next available row on Sheet 2 to copy the data.

    Thanks in advance for any help you can give, this is really helping me learn how it all works together.

    Tony

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copying from one sheet to another with complication

    This will take you to the next empty row based on Column "A" in Sheet2 if that's what you mean.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copying from one sheet to another with complication

    John,

    Thanks for the above I'm still struggling somewhat though. Maybe I didn't explain myself very well.

    Basically the code you have above works perfectly, when there is a record already that it can find and overwrite. What I would like it for the copy part to work just as well and it just to copy to the bottom of Sheet 2.

    I am by no means an expert at this so struggling to understand which part of your code relates to the copying and which part relates to the destination for instance.

    So from above I would like to copy everything from Sheet 1 B4 to Z5 into the next available (empty) row on Sheet 2

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copying from one sheet to another with complication

    Did you want to find the E value first? If so then did you want to create duplicates. What do you want to copy to the first empty row in Sheet2? I must be missing something in your request.

    "Basically the code you have above works perfectly, when there is a record already that it can find and overwrite. What I would like it for the copy part to work just as well and it just to copy to the bottom of Sheet 2."

    Does this do what you want?

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 04-26-2016 at 10:23 AM.

  11. #11
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copying from one sheet to another with complication

    Hi John,

    I am certain it is my fault - been a very long day!

    I'm not sure that covers what I need, I don't need to look up the E value this time as it is a completely new record, it will purely go and add to the bottom of the database on the next available line (I.e. copy everything from the row (73) onto the next available row on the database)

    Is that remotely clearer?

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copying from one sheet to another with complication

    Try:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copying from one sheet to another with complication

    Thank you John - works like a charm.

    You have been more than helpful!!!!

  14. #14
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copying from one sheet to another with complication

    You're welcome. Glad to help out and thanks for the feedback.

+ 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] Referencing a cell complication
    By trainerwatts3 in forum Excel General
    Replies: 4
    Last Post: 10-31-2014, 09:59 AM
  2. [SOLVED] Conditional Formatting Complication
    By Graphic Allen in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-03-2014, 10:41 AM
  3. Copying & pasting a current region to another sheet w/o actually copying.....
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2014, 09:08 PM
  4. [SOLVED] Help with extracting dates out of brackets: complication...
    By leopoldc in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 10-31-2013, 11:14 PM
  5. [SOLVED] Inputbox complication with Selection.NumberFormat
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-02-2013, 11:04 AM
  6. [SOLVED] Swap text in a cell complication
    By alexxshadows in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-14-2012, 09:06 PM
  7. Cell auto-update IF function with complication
    By rtelectric in forum Excel General
    Replies: 6
    Last Post: 05-19-2010, 11:45 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