+ Reply to Thread
Results 1 to 3 of 3

If cell is empty copy line x times and fill the blanks with predetermined text

  1. #1
    Registered User
    Join Date
    05-01-2020
    Location
    Innisfil,Ontario
    MS-Off Ver
    365
    Posts
    2

    If cell is empty copy line x times and fill the blanks with predetermined text

    Hello - I am fairly new to VBA so appreciate any help or guidance. Thank you

    I have 4 columns of data where the random blank in col C signify condensed lines. The creator wanted to reduce the # of lines so saw the pattern repeated in this cell and ignored it and removed the duplicates and said the blank represents D1,D2,D3,D5,D7,D8. I need the duplicates re-instated and these values added back in.

    and I need quick way to transform the data and expand the condensed form that where finds an empty cell in column C - duplicates/copies that row 5 times making a total of 6 lines and then adds/fill each blank cell with the 6 unique text value (i.e D1,D2 etc.) and then repeat until all blanks have been expanded back out from approx. 2000 lines of data to 8000.

    COL INT LEX PV
    345000 A 3654898
    258000 C D2 6987450
    258000 C D5 6987450
    258000 C D7 6987450
    103698 D 8521030
    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

    Cool Hi ! Try this demonstration !


    According to your attachment as a VBA beginner starter :

    PHP Code: 
    Sub Demo1()
        
    Dim R&, VU&, Rw As RangeN&
            
    1
            V 
    Sheet5.UsedRange.Value2
            U 
    UBound(V) - 1
            Application
    .ScreenUpdating False
        With Sheets
    ("desired_results")
                .
    UsedRange.Clear
            
    For Each Rw In Sheet4.UsedRange.Rows
                N 
    IsEmpty(Rw.Cells(3)) * U
                Rw
    .Copy .Cells(R1).Resize(N)
                If 
    1 Then .Cells(R3).Resize(N) = V
                R 
    N
            Next
        End With
            Application
    .ScreenUpdating True
    End Sub 
    ► Do you like it ? ► ► So thanks to click on bottom left star icon « Add Reputation » ! ◄ ◄

  3. #3
    Registered User
    Join Date
    05-01-2020
    Location
    Innisfil,Ontario
    MS-Off Ver
    365
    Posts
    2

    Thumbs up Re: If cell is empty copy line x times and fill the blanks with predetermined text

    Thank you for providing this solution - Its exactly what I needed - much appreciated

+ 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. Fill out blanks with string + # but reset # when cell above is not empty
    By thmslltrp in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-13-2019, 12:22 PM
  2. Copy row n times based on cell value in row, add new column will fill series
    By Imagination in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2015, 10:23 PM
  3. [SOLVED] Help with a Formula to Concatenate Cell Text in a New Line and Skipping Blanks
    By odoualex in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-01-2015, 12:40 PM
  4. [SOLVED] If one cell in line turn empty then entire line turns empty
    By Cristy0505 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-19-2013, 06:02 AM
  5. copy cell value (here text) to a predetermined number of cells,
    By Amsterdam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-16-2012, 03:59 PM
  6. Fill Blanks not hitting last line
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-28-2010, 12:20 PM
  7. Copy selected cell in column and fill in blanks
    By Bluestar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2005, 10:28 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