+ Reply to Thread
Results 1 to 7 of 7

Select specific range in last row with data

  1. #1
    Registered User
    Join Date
    11-08-2013
    Location
    everywhere
    MS-Off Ver
    Excel 2010
    Posts
    11

    Select specific range in last row with data

    Hi everyone, macro noob here so please be gentle.

    I tried searching for examples of what I need but kept getting search returns on finding last row or columns instead.

    I am trying to get a macro to (assuming data starts on row 4 and currently last row with data is row 15):

    1) Locate last row of cells containing values or formula for columns E:G (i.e. cells E15:G15)

    2) Paste formula into next empty range (i.e. cells E16:G16)

    3) Skip/ignore column H

    4) Locate last row of cells containing values or formula for columns I:J (i.e. cells I15:J15)

    5) Paste formula into next empty range (i.e. cells I16:J16)

    6) Skip/ignore column K

    7) Locate last row of cells containing values or formula for columns L:O (i.e. cells L15:O15)

    8) Paste formula into next empty range (i.e. cells L16:O16)

    I have multiple worksheets with similar needs but every sheet needs to be updated at a different time of the month. So looks likely that I need the macro to apply to ActiveSheet so that I can use the macro for any worksheet at any time depending on which worksheet I am working on.


    Would appreciate any help on this. Thank you!
    Attached Files Attached Files

  2. #2
    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: Select specific range in last row with data

    Paste formula into next empty range
    I don't see any formulas in you file? This macro will copy everything from the row above. To copy in a specific way change "xlPasteAll" to "xlPasteFormulas" or "xlPasteValues".

    Please Login or Register  to view this content.
    Alf

  3. #3
    Registered User
    Join Date
    11-08-2013
    Location
    everywhere
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Select specific range in last row with data

    This works perfectly! Thank you!

  4. #4
    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: Select specific range in last row with data

    Glad to be of help.

    Thanks for feed back and rep.

    Alf

  5. #5
    Registered User
    Join Date
    11-08-2013
    Location
    everywhere
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Select specific range in last row with data

    You're very welcome.

    Sorry for the silly question. But what does the last command do (i.e. what is the purpose of having this)?

    Application.CutCopyMode = False

    Just so I learn properly. Thanks!!

  6. #6
    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: Select specific range in last row with data

    Macros as well as the “normal” copy and paste operation do the copy/cut and paste in separate statements and use the clipboard as an intermediate buffer. "Application.CutCopyMode = False" clears the clipboard.

    Without that line you will get the "annoying" marching "ants" around the last copied cell and the text bottom left "Select destination and press ENTER or chose Paste".

    You may also get the warning "There is a large amount of information in the Clipbord ...' when you close the workbook with a large amount of data on the clipboard.

    I've also had macros that stopped running because I managed to "flood" the clipboard buffer when doing a copy paste loop with a number of files.

    Alf

  7. #7
    Registered User
    Join Date
    11-08-2013
    Location
    everywhere
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Select specific range in last row with data

    Very clear. Thank you.

+ 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] Select the last empty cell of the range specific
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2013, 09:48 AM
  2. Replies: 4
    Last Post: 06-17-2013, 05:21 AM
  3. [SOLVED] how to select a range and then add a specific number of cells after it
    By dwassner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-03-2012, 08:41 AM
  4. Select data range based on specific cell
    By cmb80 in forum Excel General
    Replies: 0
    Last Post: 01-22-2010, 06:36 AM
  5. Macro to Select Specific Cells in a Range
    By Magnivy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2006, 12:25 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