+ Reply to Thread
Results 1 to 13 of 13

TO copy the entire row with unique values

  1. #1
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    TO copy the entire row with unique values

    Hi there,

    Need an urgent help with this code.
    Sub copy()
    Dim lRng As RangeOp.xlsm
    Dim vRng As Range
    Dim sRng As Range
    Dim v2Rng As Range


    Dim cRng As Range
    Dim Counter As Long

    Set lRng = Sheet1.Range(Sheet1.Range("H2"), Sheet1.Range("h2").End(xlDown))

    Sheet4.Cells.Clear

    For Each vRng In lRng
    If vRng.Offset(0, 1) = "" Then
    Set sRng = vRng
    Else
    Set sRng = Sheet1.Range(lRng, lRng.End(xlToRight))
    End If

    For Each v2Rng In sRng
    Set cRng = Sheet1.Range(Sheet1.Range("A" & v2Rng.Row), Sheet1.Range("A" & v2Rng.Row).End(xlToRight))
    cRng.copy
    Sheet4.Range("A1").Offset(Counter, 0).PasteSpecial xlPasteAll
    Counter = Counter + 1
    Application.CutCopyMode = False
    Next



    Next



    End Sub

  2. #2
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: TO copy the entire row with unique values

    this is the desired output file
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: TO copy the entire row with unique values

    Please use code tags with your code. It is forum's rule to use them.
    Am I right the unique values are in sheet1 column H? And you want to copy them in to another sheet. Do you want to copy the entire row, or certain cells?

  4. #4
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: TO copy the entire row with unique values

    entire row. I have attached the desired output file as well.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: TO copy the entire row with unique values

    If the desires result sheet name is "DPG", you only have 4 columns while in the source sheet you have 12

  6. #6
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: TO copy the entire row with unique values

    Desired result is in sheet data

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: TO copy the entire row with unique values

    Cells up to line 35 are blank and then you have data in column L, so I do not know what are you trying to do. The thread of your heading and the result on the attached do not have any resemblance.

  8. #8
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: TO copy the entire row with unique values

    This is the snapshot
    Attached Images Attached Images

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: TO copy the entire row with unique values

    Please find attached.
    In your dummy data, you do not have duplicates, ie all unique values in column H, so I added a dummy duplicate row to test it.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: TO copy the entire row with unique values

    no no this is not i want. Can we connect via gtalk?

  11. #11
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: TO copy the entire row with unique values

    input file snapshot....
    Attached Images Attached Images

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: TO copy the entire row with unique values

    sgmat,
    Instead of attaching a Pic which does not help at all, why can not you attach a result sample in excel book format. You have data as an output, but has not data. How difficult is for you to say, I have these data in x sheet and want the result in this format in sheet y.? Otherwise, it is going to be guess work, so please attach your result with the above sample. You need to explain why my last code does not work, what is missing, or what is not right?

  13. #13
    Registered User
    Join Date
    07-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: TO copy the entire row with unique values

    Hi I have attached a file. in this the userdetail sheet is the input and the sheet "desired output" is the required output.
    Attached Files Attached Files

+ 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.6.0 RC 1