+ Reply to Thread
Results 1 to 6 of 6

Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem

  1. #1
    Registered User
    Join Date
    05-04-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    16

    Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem

    Dear all,

    Since I've started building Macro's there are some problems with which I need some help.
    Here is the file (at least, a mock version of it) with my current situation: Marco Problem by forum.xlsm.

    Currently, it works as follows: the upper table (<Template>) fills from a different worksheet, which is then copied and pasted (as values instead of formulas) below (tables '1' and '2'). So, each time a new project is added (cells are filled in on another sheet), it copies this new project and pastes it below the last table.
    There are two things I need to add but can't manage to build in:
    - When the table is copied, I need it to be pasted in a different font (for example the font of table '1')
    - I need a macro that clears/deletes the last added project(/table). Deleting a certain range is not the problem, getting this range to be the last added project/table is.
    Could you guys help me with this? I'd be incredibly grateful!

    Cheers,

    LennartB

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,371

    Re: Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem

    Please Login or Register  to view this content.

    Or, a more generic version, assuming you are adding "tables" to the bottom of the sheet.

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    05-04-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    16

    Re: Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem

    Hi TMS,

    Thanks for your quick response and the code provided!
    It was very useful to me, although I needed to 'Clear' the cell & adjust them to the font I use instead of using 'ClearContent'.
    However, with your code as a guideline, combined with my limited knowledge of VBA, I've managed to get just what I needed:

    Please Login or Register  to view this content.
    Ignore change in the sheetname and columns, that's of course to get a fitting transfer. A thanks a ton for making this possible!

  4. #4
    Registered User
    Join Date
    05-04-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    16

    Re: Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem

    And now, there is my second problem. Right now, I am able to copy&paste the right cells in the right place (below each other) and now I am also able to delete these (last pasted) cells. The last thing I need is a font change, only for the pasted cells.
    With my current knowledge, I've been able to correctly adjust the font only of the first set of pasted cells. So, in other words, my font change code is static where I need it to be changing with range, dynamic. This means that every part of cells pasted below gets the same font.

    This is my code:
    Please Login or Register  to view this content.
    I guess that right at the lines I've made bold, I need to insert this 'dynamic code', the sort of code used in the underlined/italic lines.
    Lots of thanks in advance!

    Cheers

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,371

    Re: Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem

    You're welcome. Thanks for the rep.


    Second problem = new problem. And the original problem has been solved, in part by us and in part by yourself but, nevertheless, it is solved.

    I suggest that you mark it solved and start a new thread, ideally with a link back to this thread for background. That way you'll get new eyes and new input and they hit the ground running.

    Regards, TMS

  6. #6
    Registered User
    Join Date
    05-04-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    16

    Re: Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem

    You're absolutely right, I'll do that.

    Thanks again!

+ 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] problem in macro recording copy and paste in new excel file,
    By vengatvj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2013, 12:37 AM
  2. Problem with Macro to delete Rows containing certain text
    By fmluder93 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-22-2012, 07:22 AM
  3. [SOLVED] Excel Macro to delete rows problem
    By Ardiko in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-19-2012, 10:22 AM
  4. Add rows and search/copy/paste text into added rows
    By HelenW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-14-2010, 04:06 AM
  5. Replies: 3
    Last Post: 12-09-2005, 01:20 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