+ Reply to Thread
Results 1 to 7 of 7

VBA Code to only copy cells with data within a range

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    VBA Code to only copy cells with data within a range

    Dear Experts,

    Can someone please help?
    In Excel 2010 I have a spreadsheet in which I enter data on one sheet and then the data gets copied to another Spreadsheet. What I would like to do is have the code only copy Cells in range "e5:j55" that only have values instead of all.
    So for example one day I may enter 50 records of data, and the next I may enter only 10 records. The amount of records will vary from day to day and will never exceed 50 records.

    The current code is :

    Please Login or Register  to view this content.
    Last edited by lebroj; 01-20-2017 at 11:41 PM. Reason: To Comply with Rule 3

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Code to only copy cells with data within a range

    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

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    09-06-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: VBA Code to only copy cells with data within a range

    Thanks for pointing this out to me. I have made adjustments to the post.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Code to only copy cells with data within a range

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-06-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: VBA Code to only copy cells with data within a range

    Thanks Mehmetcik, it work as expected with only one issue. Column J has a formula and During the copy/paste it leaves this blank, however if I enter a value in column J manually then the value is copied accordingly.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Code to only copy cells with data within a range

    Try this


    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-06-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: VBA Code to only copy cells with data within a range

    This last code is not providing the desired results, but I reviewed my spreadsheet and made some modifications. Your Code provided on 1/21 works perfectly on my modified sheet. Thanks!

+ 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] VB Code to copy formula in range of cells
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2017, 09:31 PM
  2. Creating a VBA code to copy a range of cells from one part of a worksheet to another
    By amconner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2015, 03:43 PM
  3. [SOLVED] VBA code for not copy data in Sheet2 if all cells in range in Sheet1 are not filled
    By ginodauri in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2013, 12:33 PM
  4. Replies: 3
    Last Post: 03-26-2013, 06:06 PM
  5. Replies: 0
    Last Post: 03-26-2013, 02:58 PM
  6. VB Code To Copy Range Of Cells
    By rockyw in forum Excel General
    Replies: 10
    Last Post: 02-08-2011, 12:09 PM
  7. code to copy a range of cells to another sheet
    By Robb27 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-04-2006, 06:30 AM

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