+ Reply to Thread
Results 1 to 9 of 9

Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd column

  1. #1
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd column

    Quick background of project:

    I have an excel table where the furthest right column needs to be copied one column to the right each time the button above that furthest right positioned column is pushed. Everything must be copied over, including values and formats. I have this working great except that after the "third" newly created column, the formatting is lost. I'm now at the point where I need some fresh eyes to look at this code for me.

    I've given it 4 hours of troubleshooting and I'm nowhere further ahead then I was 4 hours ago. Any help, or direction that somebody can give me is greatly appreciated.

    Here is my working code. (Up until the "4th" new column that is)

    Please Login or Register  to view this content.
    Please don't hesitate to respond with any questions or concerns. I will be very quick to reply as I need to clear this hurdle before I can continue on with the project.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    Thank you for your time AlphaFrog. See attached example file.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    Once you download the file, locate the red "plus symbol" button above the first data entry column (Col E). Press that button 4 times and watch what happens to the 4th column. The formatting disappears. Specifically, the cell fills.
    Last edited by xlyfe; 04-16-2018 at 02:58 PM.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    It worked for me well past the fourth column.

    I don't know if this will help, but the code below first adds a new column to the table then pastes to it.

    Also, don't you want to move the button over one column instead of copying it?

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    Thank you AlphaFrog. The code seems to work great, albeit, a tad bit slower to process for some reason, but still works great.

    I didn't even think of referencing the table object.

    Only thing is that I actually do want to copy over that button instead of moving it. Reason being is I'd like to give the user
    the ability to delete columns should they need to. I'm working on tweaking that second part of the code right now to see if I
    can make that happen.

  7. #7
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    I just plopped this back in the middle portion there and it's back to normal. Also, calculation speed seemed to increase back to normal again too.

    Please Login or Register  to view this content.
    Thanks again for your help AlphaFrog!!

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    Glad it helped. You may want to suspend screen updating to prevent flickering.

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Button to Copy Column Range with ActiveCell position, Losing formatting after 3rd colu

    Awesome idea. I just put that in there and it's much more pleasing to the eye. Thanks for the great idea! Now onto the next part of this voyage.

    Once again, I can't thank you enough kind sir. May your life be filled with a million good karma's.

+ 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] Use Activecell.column to copy
    By Crispy85 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-13-2016, 08:19 AM
  2. [SOLVED] Change column reference within a range by numeric position within the range
    By SteveSwitch in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-19-2013, 08:21 AM
  3. [SOLVED] Moving a range one column to the right without losing the cell references
    By phook01 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-21-2013, 10:11 AM
  4. [SOLVED] Cond. formatting a column/Range, highlight cell in column/range if equal to specific text
    By DFrank231 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-19-2013, 03:35 PM
  5. [SOLVED] Can a Command Button's position be kept moving along the TargetCell ROW in the same Column
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-03-2012, 09:40 AM
  6. activecell column to a given range
    By Peter Morris in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-04-2006, 02:00 PM
  7. Replies: 4
    Last Post: 09-14-2005, 05:05 PM

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