+ Reply to Thread
Results 1 to 11 of 11

copy formulas with a line inbetween

  1. #1
    Forum Contributor
    Join Date
    03-31-2017
    Location
    usa
    MS-Off Ver
    2013
    Posts
    104

    copy formulas with a line inbetween

    hi, I have the pattern of data below where there's a blank cell in the first position of the second row. Is there a way to copy the formulas in the first line all the way down in one step with code? If I use the downward end of data keystroke in code it will stop at the blank line and then I have to use another line of code to copy from the second line to the end of the data.

    1 2 3 4
    a b c d
    5 6 7 8
    j k l m
    9 10 11 12

  2. #2
    Forum Contributor
    Join Date
    03-31-2017
    Location
    usa
    MS-Off Ver
    2013
    Posts
    104

    Re: copy formulas with a line inbetween

    Sorry, the data should look like this. There is no data in the first position of the second row.


    1 2 3 4
    b c d
    5 6 7 8
    j k l m
    9 10 11 12

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: copy formulas with a line inbetween

    Select two cells, the cell with the formula and the blank cell below it.
    Grab the drag handle and drag downwards.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    03-31-2017
    Location
    usa
    MS-Off Ver
    2013
    Posts
    104

    Re: copy formulas with a line inbetween

    what would it be in code?

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: copy formulas with a line inbetween

    Maybe:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: copy formulas with a line inbetween

    In VBA that would look like
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-31-2017
    Location
    usa
    MS-Off Ver
    2013
    Posts
    104

    Re: copy formulas with a line inbetween

    thx john and mike. Can we make the techniques more generic so it can work on whatever cell it's on and copy down to however long the data rows are?

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: copy formulas with a line inbetween

    See if this helps:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 08-17-2017 at 01:44 PM.

  9. #9
    Forum Contributor
    Join Date
    03-31-2017
    Location
    usa
    MS-Off Ver
    2013
    Posts
    104

    Re: copy formulas with a line inbetween

    the last line is trying to copy the entire row and not just the where the data is. I think it may just be easier to just do it in two simple steps for now. thx for your help.

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: copy formulas with a line inbetween

    Try:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    03-31-2017
    Location
    usa
    MS-Off Ver
    2013
    Posts
    104

    Re: copy formulas with a line inbetween

    it's getting better but still not right. this one is going to the row above the cursor and copying it to the original cursor row. I was trying to get the info in the cursor row and copy it to two lines below, skipping the line right after the original cursor row. it's probably not worth the extra time since I can do it fairly easily in two separate steps.

+ 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. VBA code to copy line items from form - overriding previous line item
    By dkostyan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2016, 11:19 AM
  2. Replies: 2
    Last Post: 05-13-2015, 06:52 AM
  3. Copy pasting from Excel issue - NEW LINE/LINE BREAK
    By denneboom in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-07-2012, 06:40 AM
  4. Insert Line Every Other Row w/Multiple Formulas based on Line Above
    By xyshel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2011, 11:09 AM
  5. Add line and copy formulas doesn't work with a macro
    By Jehan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2008, 06:39 PM
  6. Replies: 1
    Last Post: 12-13-2005, 02:00 PM
  7. Replies: 8
    Last Post: 11-30-2005, 09:55 AM

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