+ Reply to Thread
Results 1 to 11 of 11

MacroButton to Copy last Column to end

  1. #1
    Registered User
    Join Date
    11-15-2016
    Location
    Maryland, US
    MS-Off Ver
    2016
    Posts
    29

    MacroButton to Copy last Column to end

    Hello,
    I am working on a spreadsheet where I need a macro button that users can click on and add a copy of the last column to the end of the columns. I tried recording a macro, but it won't work because it inserts the columns in different places on the sheet and not at the end of the columns.
    Thank you in advance for your assistance.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: MacroButton to Copy last Column to end

    May be
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: MacroButton to Copy last Column to end

    A bit less code but quite similar to Yasser's code

    Please Login or Register  to view this content.
    Alf

  4. #4
    Registered User
    Join Date
    11-15-2016
    Location
    Maryland, US
    MS-Off Ver
    2016
    Posts
    29

    Re: MacroButton to Copy last Column to end

    Hi Yasser,
    Thank you. It's almost there. It is copying the column and placing it at the end, but it is not copying the format.
    See attached image.
    Picture2.png
    Last edited by RubenExcel; 03-03-2017 at 09:07 AM.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: MacroButton to Copy last Column to end

    Hello RubenExcel,

    Please try the Code below.

    Please Login or Register  to view this content.
    Enjoy!

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  6. #6
    Registered User
    Join Date
    11-15-2016
    Location
    Maryland, US
    MS-Off Ver
    2016
    Posts
    29

    Re: MacroButton to Copy last Column to end

    Hi,
    I was trying to use this formula that I found in YouTube to copy rows - I modified it a little to copy columns, and it was almost working, but it was placing the columns in different parts of the sheet. It was copying the format of the other columns without content. Just wanted to share just in case it helps.

    Please Login or Register  to view this content.
    Last edited by RubenExcel; 03-03-2017 at 11:51 AM.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: MacroButton to Copy last Column to end

    That is because you are trying to bake a bread with the ingredients for soup. Why add extra code to obtain Borders, while my Code does everything as per your request, or does it not work for you?

    Also Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Please do that, since we all are bound to the Forum Rules.

    Thank you so much.

  8. #8
    Registered User
    Join Date
    11-15-2016
    Location
    Maryland, US
    MS-Off Ver
    2016
    Posts
    29

    Re: MacroButton to Copy last Column to end

    Thanks. I had not tried your code when I posted that other formula. I posted it with the intention that it may help.
    Sorry about the code thing. I think I fixed it.
    I tried your code and it is working.
    Thank you.

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: MacroButton to Copy last Column to end

    Yes, that's the way to Go! Thank you for adding the Code Tags.

    You are Welcome RubenExcel, glad we could help.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Good luck with your project further on!

    Thanks.

  10. #10
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: MacroButton to Copy last Column to end

    @ Alf,

    Using the UsedRange is not always that reliable, since Excel consider the last used Cell or Range, even if it has been Cleared, as part of the UsedRange while ignoring whether the Cell or Range contains Data or not.

    @ YasserKhalil,

    What a nice surprise!

    Thank you for your acknowledgement, and for adding to my Reputation. I really appreciate it my friend!

    Kind Regards.

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: MacroButton to Copy last Column to end

    Hi RubenExcel,

    Thank for marking the Thread as Solved and for adding to my Reputation, much appreciated!

    Kind Regards.

+ 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. Copy data from sheet1 column with dynamic date, and copy data to second sheet column
    By Renaliiii in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-25-2016, 04:44 PM
  2. Replies: 1
    Last Post: 05-30-2015, 04:38 PM
  3. Excel copy images from Column B to column C and give them name of column A
    By sofianeuk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2015, 07:41 PM
  4. Replies: 5
    Last Post: 11-17-2014, 02:40 PM
  5. [SOLVED] Macro to highlight keywords-Macrobutton not working fine
    By Awalgaonkar in forum Word Formatting & General
    Replies: 2
    Last Post: 03-27-2013, 08:03 AM
  6. Vba - find next empty column, insert column, copy paste values & copy paste formulas
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 12:43 PM
  7. Disable a macrobutton for a particular cell change?
    By lotus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-14-2005, 05:38 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