+ Reply to Thread
Results 1 to 6 of 6

Macro to insert a rage of cells deletes previous content if range is blank

  1. #1
    Registered User
    Join Date
    04-26-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    31

    Macro to insert a rage of cells deletes previous content if range is blank

    Hi All, I have a macro in a rostering worksheet which copies overtime details in a range of data,("E8:H22") to another area of a worksheet ("Q100"), then adds the date from ("C6"), deletes blank rows and copies cells with data and inserts it at ("P8:T8"), this works fine if there is content in the cells however if there is nothing to insert it deletes previous content. The way I am doing this is probably taking the long way around, ideally I would like to be able to copy the details directly under ("P8:T8") with date, but I would be happy to know how to have the macro stop copying to ("P8:T8") if there is no content and move on. Thanks in advance, Ed


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro to insert a rage of cells deletes previous content if range is blank

    Please Login or Register  to view this content.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert a rage of cells deletes previous content if range is blank

    I answered the first post - so you've gotten two answers for this
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    04-26-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Macro to insert a rage of cells deletes previous content if range is blank

    Hi folks, sorry for the duplication and confusion I had difficulty attaching my sample file. In the interim I came up with a solution of my own which works (and I understand), I will study your suggestions. I appreciate all your assistance. Thanks very much, Ed.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert a rage of cells deletes previous content if range is blank

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

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert a rage of cells deletes previous content if range is blank

    BTW - Your code will fail if there are no blanks in Q100:Q114

+ 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. Help with Code That Searches for a Blank Row and Deletes it within a Range
    By b0ttle in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2014, 03:57 PM
  2. Macro for adding blank cells based on previous data
    By kelcomel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2010, 12:41 PM
  3. Writing a macro that deletes blank rows
    By britt@wjg in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-11-2008, 02:33 PM
  4. How to create a macro that deletes every blank row in a spreadshee
    By Grd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2005, 06:50 PM
  5. RE: How to create a macro that deletes every blank row in a spread
    By Grd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-14-2005, 06:35 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