+ Reply to Thread
Results 1 to 7 of 7

Thread: Auto fill text using formula or code

  1. #1
    Registered User
    Join Date
    07-12-2007
    Posts
    10

    Auto fill text using formula or code

    I am looking for a formula or code that will take information from Sheet1 and on Sheet2 it will copy down each column and duplicate each row based on the value in Column I. So for instance, Row 1 will duplicate 5 times before moving on to the next row which will only be listed once on sheet 2. I have filled in on Sheet 2 what I would like it to look like. Thanks in advance
    Attached Files Attached Files
    Last edited by nicmarty; 10-29-2010 at 09:30 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Auto fill text using formula or code

    Weirdly this is almost exactly the same question as epi's, immediately below yours.

  3. #3
    Registered User
    Join Date
    07-12-2007
    Posts
    10

    Re: Auto fill text using formula or code

    Wow, that is weird!

  4. #4
    Registered User
    Join Date
    07-12-2007
    Posts
    10

    Re: Auto fill text using formula or code

    Can this be done from by pulling from sheet1 to sheet2 like I'd like to do? I have formulas in sheet1 which pulls all that info to begin with, I don't want to affect sheet1 at all.

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Auto fill text using formula or code

    Sorry, that wasn't a very helpful response from me. Easily done with code, I'll look tomorrow if no-one else has in the meantime.

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Auto fill text using formula or code

    If you clean up the random entries on sheet1 around row 2000, this should work:
    Sub x()
    
    Dim v, i As Long, j As Long, k As Long
    
    Application.ScreenUpdating = False
    
    v = Sheet1.Range("A2", Sheet1.Range("A" & Rows.Count).End(xlUp)).Resize(, 9).Value
    
    Sheet2.UsedRange.Offset(1).ClearContents
    
    For i = LBound(v, 1) To UBound(v, 1)
        With Sheet2.Range("A" & Rows.Count).End(xlUp)(2)
            For k = 1 To 9
                .Offset(, k - 1).Resize(v(i, 9)).Value = v(i, k)
            Next k
        End With
    Next i
    
    Application.ScreenUpdating = True
    
    End Sub

  7. #7
    Registered User
    Join Date
    07-12-2007
    Posts
    10

    Re: Auto fill text using formula or code

    Perfect!! Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0