none
data repetition RRS feed

  • Question

  • I have a table with data. I want data to be repeated in cells when there is a repetition in particular column from another column like below.

    please help,

    regards

    dockhem

    Friday, August 29, 2014 2:04 PM

Answers

  • Sub Test()
      Dim D As Range, C As Range
      'For each value in column D
      For Each D In Range("D2", Range("D" & Rows.Count).End(xlUp))
        'Search in column C
        Set C = Columns("C").Find(D, LookIn:=xlValues, LookAt:=xlWhole)
        'Found?
        If Not C Is Nothing Then
          'Copy columns E:I from row of C into row of D
          Intersect(Range("E:I"), C.EntireRow).Copy Intersect(Range("E:I"), D.EntireRow)
        End If
      Next
    End Sub
    


    Saturday, August 30, 2014 4:14 PM
  • Hi Dockhem,

    The solution provied by Andreas suppose the data you provided in the sample is stated with column A and it works well for me. If the context is different, you can modify the column as fingure below:

    Also links below are helpful to understand the code above:
    Range.Find Method

    Application.Intersect Method (Excel)

    Welcome to the Excel 2013 developer reference

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, September 9, 2014 9:25 AM
    Moderator

All replies