i tried on more ways to border the result of the variable V2
in Column E but it doenst work. You can see my tryings as a comment within the code. Has anyone an idea? Thanks
By the way is it possible to figure out End(xlUp)
& End(xlDown)
just by a Macro?
Update
This i could figure out by pressing shift +Cntrl + ArrowDown
Sub Duplicate()
Dim nA As Long, nD As Long, i As Long, rc As Long
Dim s As String, j As Long
'Dim LastRow As Long
'Dim rng2 As Range
Range("A:A").Copy Range("D1")
Range("B1").Copy Range("E1")
Range("D:D").RemoveDuplicates Columns:=1, Header:=xlYes
rc = Rows.Count
nA = Cells(rc, 2).End(xlUp).Row 'grün
nD = Cells(rc, 4).End(xlUp).Row 'gelb
For i = 2 To nD 'gelb
v = Cells(i, 4) 'gelb
V2 = "" 'rot
For j = 2 To nA 'grün
If v = Cells(j, 1) Then 'orange
V2 = V2 & "," & Cells(j, 2) 'rot / ZU UMRANDEN
End If
Next j
Cells(i, 5) = Mid(V2, 1) 'rot / 1 = Start erstes Zeichen
Next i
'LastRow = Cells(Rows.Count, 5).End(xlUp).Row
'Range("E:E" & LastRow).Borders (xlInsideHorizontal)
'Set rng2 = ActiveSheet.Range("E:E", ActiveSheet.Cells(ActiveSheet.Rows.Count, 1).End(xlUp))
' rng2.HorizontalAlignment = xlLeft
'With rng2.Borders()
' .LineStyle = xlContinuous
' .ColorIndex = 0
' .TintAndShade = 0
' .Weight = xlThin
'End With
Debug.Print
End Sub
Update
How it is right now
How it shall be
Update
final need had been like this