+ Reply to Thread
Results 1 to 7 of 7

Duplicate current row, highlight duplication, and select cell in newly inserted row

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    4

    Duplicate current row, highlight duplication, and select cell in newly inserted row

    Hi,

    First off I want to declare that I'm a complete newbie. I'm usually good at hacking and modifying bits of code to do what I want, but although I've found macros that partially do what I need, I haven't been able to come up with a full function to accomplish what I need.

    What I need is:

    * Duplicate the current *table* row (where the active cell currently is)
    * Have the newly created duplicate be highlighted in yellow
    * Have the active cell set somewhere on the newly duplicated row (so that the macro can be repeated as needed--I plan to apply to macro to a button)

    What I have so far:

    This bit of code will add a row:
    Please Login or Register  to view this content.
    This other bit of code is supposed to highlight (somehow):
    Please Login or Register  to view this content.
    I saw this thread but couldn't get the code to work: http://www.excelforum.com/excel-prog...erted-row.html


    If someone can please help me piece together what I need I'd appreciate it immensely.

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Duplicate current row, highlight duplication, and select cell in newly inserted row

    try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-04-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Duplicate current row, highlight duplication, and select cell in newly inserted row

    Kalak, this is pretty cool--I tried it and it appears to work perfectly to do exactly what I needed. I need to learn some VBA--I'm very impressed with that code and don't understand how it's shorter than what I ran across but still manages to do all that I needed.

    Thank you so much!

  4. #4
    Registered User
    Join Date
    10-04-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Duplicate current row, highlight duplication, and select cell in newly inserted row

    One last question:

    How can I make it highlight only the contents inside the table and not the entire row past the end of the table? I'd want to do this so that when I re-arrange my rows the highlighted rows outside the table do not get left behind...

  5. #5
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Duplicate current row, highlight duplication, and select cell in newly inserted row

    narfz,

    does this work for you?
    Please Login or Register  to view this content.
    Note that will only do correct row if table starts from the top row in the worksheet.
    If otherwise I'll re-look at it, but don't have time for a while.

  6. #6
    Registered User
    Join Date
    10-04-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Duplicate current row, highlight duplication, and select cell in newly inserted row

    Kalak,

    You're right, it does work, but only if the table is all the way to the top, I have a title and other information on my first row so this doesn't work as is because it ends up adding the rows lower.

    I appreciate your help--no rush, your first solution got me through but let me know if you have time to figure out the other part.

    Thanks!

  7. #7
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Duplicate current row, highlight duplication, and select cell in newly inserted row

    a somewhat untidy modification. but maybe it works for you
    Please Login or Register  to view this content.

+ 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