+ Reply to Thread
Results 1 to 11 of 11

Code for coping a whole row from one sheet to another

  1. #1
    Registered User
    Join Date
    08-17-2013
    Location
    chicago
    MS-Off Ver
    Excel 2003
    Posts
    27

    Exclamation Code for coping a whole row from one sheet to another

    Hi I have a code:
    Please Login or Register  to view this content.
    It copies a cell from sheet 1 into a cell in sheet 2, however I need it to copy the whole row (and place it into the appropriate columns (the columns match the first sheet)). What should I change?

    Thank you for your help

    Moderators note: code tags added for you - this time
    Last edited by sunshne900; 09-22-2013 at 12:59 AM.

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

    Re: Code for coping a whole row from one sheet to another

    Please Login or Register  to view this content.
    Last edited by patel45; 09-22-2013 at 01:59 AM.
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Code for coping a whole row from one sheet to another

    Hi, sunshne900,

    instead of setting the range to the cells in Column I
    Please Login or Register  to view this content.
    try using this line
    Please Login or Register  to view this content.
    If 152 is not a variable but the row up to which should be used you may write the code like
    Please Login or Register  to view this content.
    Please mind that a whole row should be inserted starting at Column A in the target sheet.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    08-17-2013
    Location
    chicago
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Code for coping a whole row from one sheet to another

    Hi Holger,
    What if I just wanted to copy certain columns how would I write that?

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Code for coping a whole row from one sheet to another

    Hi, sunshne900,

    if you want to copy a known number of Columns code may look like this
    Please Login or Register  to view this content.
    to cover the range between A3 and I152.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    08-17-2013
    Location
    chicago
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Code for coping a whole row from one sheet to another

    WHAT if the columns are not next to each other and their content need to be copied to specific columns in sheet 2 ????

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Code for coping a whole row from one sheet to another

    Hi, sunshne900,

    maybe like this:
    Please Login or Register  to view this content.
    Building 2 arrays holding the columns from which to copy and where to put the data.

    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    08-17-2013
    Location
    chicago
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Code for coping a whole row from one sheet to another

    Hi Holger,
    The info I am trying to copy is filtered and I need it to stay filtered, how would the code change then?

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Code for coping a whole row from one sheet to another

    Hi, sunshne900,

    The info I am trying to copy is filtered
    Please Login or Register  to view this content.
    If you change the code you use it would be nice if you post the altered code as well.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    The original thread title was about copying a whole row - I think that has been solved?

    Ciao,
    Holger

  10. #10
    Registered User
    Join Date
    08-17-2013
    Location
    chicago
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Code for coping a whole row from one sheet to another

    Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  11. #11
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Code for coping a whole row from one sheet to another

    Hi, sunshne900,

    thanks for the feedback and the rep - do you mind marking the thread as Solved via Thread Tools over the first post?

    Ciao,
    Holger

+ 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. Two question, numeric code question and subtraction of two columns?
    By mgsweden78 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-18-2008, 02:50 AM
  2. VBA Code Question
    By JasonHerndon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2007, 05:59 PM
  3. [SOLVED] code question
    By Ana in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2006, 05:55 AM
  4. Code Question
    By Ronbo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2005, 05:05 PM
  5. code question
    By Gary Keramidas in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-19-2005, 01:05 PM

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