+ Reply to Thread
Results 1 to 6 of 6

Insert Blank Row - If Range contains a value

  1. #1
    Forum Contributor
    Join Date
    10-04-2014
    Location
    USA
    MS-Off Ver
    MS Office 2013
    Posts
    146

    Insert Blank Row - If Range contains a value

    I would like to use the following code but am getting an error when trying to insert a blank line?
    Thanks so much in advance!

    Sub Spacerz()

    Dim Spacer As Range

    'Insert New Line Seperator
    For Each Spacer In ActiveSheet.Range("AB2:AB200")
    If Spacer.Value = "0" Then Spacer.EntireRow.Insert
    Next Spacer

    End Sub

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Insert Blank Row - If Range contains a value

    Hi, hftechno,

    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.

    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)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    10-04-2014
    Location
    USA
    MS-Off Ver
    MS Office 2013
    Posts
    146

    Re: Insert Blank Row - If Range contains a value

    Please Login or Register  to view this content.

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

    Re: Insert Blank Row - If Range contains a value

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-04-2014
    Location
    USA
    MS-Off Ver
    MS Office 2013
    Posts
    146

    Re: Insert Blank Row - If Range contains a value

    Again Worked like a charm!
    Tried to show you some more reputation love but was unable to.

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

    Re: Insert Blank Row - If Range contains a value

    You're welcome. Glad to help out and thanks for the feedback.

+ 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] Macro to insert a rage of cells deletes previous content if range is blank
    By 54ed in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-24-2014, 12:01 AM
  2. [SOLVED] Macro to insert a rage of cells deletes previous content if range is blank
    By 54ed in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2014, 05:59 PM
  3. Macros to insert 2 blank row and autosum a column after every 200 rows in data range.
    By sachinsingh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-22-2013, 09:55 AM
  4. Insert a blank row in middle of a range
    By batman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-14-2007, 05:49 PM
  5. variable - insert blank row/select range
    By Jan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-13-2006, 12:45 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