Option Explicit
Option Compare Text
Private Sub UserForm_Initialize()
Dim Cel As Range, Data As Range, Line As Range, It As ListItem, color
With ThisWorkbook.Sheets("Journal")
Set Data = .Range("A1").CurrentRegion
For Each Line In Data.Rows
With Me.ListView1
If Line.Row = 1 Then
.ListItems.Clear
With .ColumnHeaders
.Clear
For Each Cel In Line.Cells
.Add , , Cel, Cel.Width
Next
End With
Else
color = Color_Lvw(Line.Cells(1))
Set It = Nothing
For Each Cel In Line.Cells
If It Is Nothing Then
Set It = .ListItems.Add(, , Cel)
It.ForeColor = Color_Lvw(Cel.Text)
Else
It.ListSubItems.Add(, , Cel).ForeColor = It.ForeColor
End If
Next
End If
End With
Next
If Me.ListView1.ListItems.Count > 0 _
Then Me.ListView1.ListItems(Me.ListView1.ListItems.Count).EnsureVisible
End With
End Sub