+ Reply to Thread
Results 1 to 4 of 4

Add new line based off cell value

  1. #1
    Registered User
    Join Date
    03-17-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    38

    Add new line based off cell value

    Greetings! I need a way of in vba to accomplish the below - am attaching a sample workbook where the first worksheet shows current set-up and the second worksheet shows how I need the VBA to split the data

    if column bp is not null (it can contain text or int values) I need to add a new row directly under the current row.

    Then in the 1st row (original) I need to remove the text in column B and H
    and in the 2nd row (new) I need to remove the text in column F and K

    (Any other copied values are legal to remain on both lines)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Add new line based off cell value


    Hi !

    As your explanation does not match your desired worksheet, check then clearly explain …

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

    Re: Add new line based off cell value

    Does this help?

    Please Login or Register  to view this content.
    Marc is right your explanation does not match your desired result sheet.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Add new line based off cell value


    Demonstration upon explanation only, not on desired worksheet :

    PHP Code: 
    Sub Demo()
             
    Application.ScreenUpdating False
        With ActiveSheet
    .UsedRange.Rows
            
    For R& = .Count To 2 Step -1
                
    If .Cells(R14).Value "" Then
                   
    .Item(R).Copy
                   
    .Item(R).Insert xlShiftDown
                    Union
    (.Cells(R2), .Cells(R8), .Cells(16), .Cells(111)).ClearContents
                End 
    If
            
    Next
        End With
             Application
    .ScreenUpdating True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

+ 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. Drawing a line on a sheet based off cell value
    By LeapingLizard in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-19-2016, 04:03 PM
  2. Auto Sort line items based off of cell color
    By Jscott1601 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2013, 03:03 PM
  3. VBA to add a double line bottom border based on cell value
    By KDF in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-09-2013, 06:16 PM
  4. Combining multiple line items into one line item based on column.
    By mguz018 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-20-2012, 07:22 PM
  5. Move a line from one worksheet to another based on a single cell
    By dawondr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2012, 07:04 PM
  6. Replies: 3
    Last Post: 02-10-2012, 11:55 AM
  7. plotting a horizontal line based on a cell value
    By justin111 in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 02-23-2011, 12:25 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