+ Reply to Thread
Results 1 to 13 of 13

Formula to start on next blank line

  1. #1
    Registered User
    Join Date
    06-28-2021
    Location
    Colorado, USA
    MS-Off Ver
    Office 365
    Posts
    25

    Formula to start on next blank line

    Hi I have the below macro which is supposed to insert a formula to the next blank row. It is giving me an error. Does anyone have any insight as to why?

    Range("A1").End(xlDown).Offset(1, 0).Select
    ActiveCell.FormulaR1C1 = "=IF(RC[15]="""","""",RC[15])"
    Selection.AutoFill Destination:=Range("A2:A" & Range("L" & Rows.Count).End(xlUp).Row)
    Range(Selection, Selection.End(xlDown)).Select

    Thank you!

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Formula to start on next blank line

    Copied from the help file.

    This example performs an autofill on cells A1:A20 on Sheet1, based on the source range A1:A2 on Sheet1. Before running this example, type 1 in cell A1 and type 2 in cell A2.

    Visual Basic for Applications
    Please Login or Register  to view this content.
    If you explain what you want to achieve, someone will supply you with proper code.
    Last edited by jolivanes; 07-19-2021 at 07:27 PM.

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Formula to start on next blank line

    Study these three procedures:
    Please Login or Register  to view this content.
    Artik
    Last edited by Artik; 07-19-2021 at 07:43 PM.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Formula to start on next blank line

    This might be a possibility also.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-28-2021
    Location
    Colorado, USA
    MS-Off Ver
    Office 365
    Posts
    25

    Re: Formula to start on next blank line

    Thank you all for your responses. I am trying to copy data in the same worksheet, to the bottom of current columns. For example, data from R should be copied to the bottom of A.

  6. #6
    Registered User
    Join Date
    06-28-2021
    Location
    Colorado, USA
    MS-Off Ver
    Office 365
    Posts
    25

    Re: Formula to start on next blank line

    Thank you! I tried this, but all of my cell came out blank.

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Formula to start on next blank line

    If we don't know the layout of your sheet it'll be guessing forever.
    We don't know the last used cell in each column. Are they all filled to the same row? How may columns do have in use?
    Do any columns need to be cleared before anything else happens?
    Explain in detail. You know what your sheet looks like but we don't.

  8. #8
    Registered User
    Join Date
    06-28-2021
    Location
    Colorado, USA
    MS-Off Ver
    Office 365
    Posts
    25

    Re: Formula to start on next blank line

    Sorry, I just recently discovered this site. My spreadsheet goes from column A to GU. My goal is to copy some of the columns from L:GU to A:K. I am only copying 6 columns of data from L:GU. A:K are filled to the same row with data. After copying the the data I need, L:GU will be deleted. Nothing needs to be cleared. I currently have the macro set up and it does everything I need, except it pastes the data over the existing data in A:K.

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Formula to start on next blank line

    A generic Copy and Paste would be something like
    Add and change as required.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-28-2021
    Location
    Colorado, USA
    MS-Off Ver
    Office 365
    Posts
    25

    Re: Formula to start on next blank line

    Thank you! This seems to work, the only issue is that it copies the header row as well. Is there a way to exclude the header?

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Formula to start on next blank line

    Start from the 2nd cell and resize 1 less
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    06-28-2021
    Location
    Colorado, USA
    MS-Off Ver
    Office 365
    Posts
    25

    Re: Formula to start on next blank line

    You are amazing, thank you so much!

  13. #13
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Formula to start on next blank line

    Thank you for letting us know that your happy.
    Good Luck

+ 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. Replies: 17
    Last Post: 01-27-2020, 02:16 AM
  2. [SOLVED] vba code to check if the formula is blank, then create another line
    By chubbychub in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2018, 01:35 PM
  3. [SOLVED] Need to delete blank rows from start range to next blank row
    By maym in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-12-2018, 10:24 PM
  4. [SOLVED] Concatenate If Blank - remove blank line if first cell is blank
    By ker9 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-27-2014, 02:14 PM
  5. [SOLVED] Insert blank line and sum formula after each item
    By madhatter40 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2013, 12:54 AM
  6. Replies: 2
    Last Post: 07-19-2013, 10:13 AM
  7. Replies: 1
    Last Post: 05-29-2013, 03:31 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