Private Sub UserForm_Initialize()
Dim i As Long
Dim c As Integer
Me.ListView1.ListItems.Clear
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 1), 30 'sl
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 2), 60 'inv no
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 3), 50 'date
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 5), 88 'billing
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 24), 38 'term
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 23), 50 'orig Amt
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 118), 50 'outstanding
Me.ListView1.ColumnHeaders.Add , , Sheet4.Cells(2, 119), 50 'Paid
Me.ListView1.ColumnHeaders(6).Alignment = lvwColumnRight
Me.ListView1.ColumnHeaders(7).Alignment = lvwColumnRight
Me.ListView1.ColumnHeaders(8).Alignment = lvwColumnRight
For i = 3 To Sheet4.Range("a1000000").End(xlUp).Row
If Sheet4.Cells(i, "DN").Value >= 0.01 Then
Set itm = Me.ListView1.ListItems.Add(Text:=Sheet4.Cells(i, "A")) 'sl
itm.ForeColor = vbRed
itm.SubItems(1) = Sheet4.Cells(i, "B") 'inv no
itm.SubItems(2) = Format(Sheet4.Cells(i, "C"), "dd-MM-yy") 'date
itm.SubItems(3) = Sheet4.Cells(i, "E") 'billing
itm.SubItems(4) = Sheet4.Cells(i, "X") 'term
itm.SubItems(5) = Format(Sheet4.Cells(i, "W"), "####0.00") 'orig Amt
itm.SubItems(6) = Format(Sheet4.Cells(i, "DN"), "####0.00") 'outstanding
itm.SubItems(7) = Format(Sheet4.Cells(i, "DO"), "####0.00") 'Paid
End If
Next i
End Sub
this code work, but only for the first column in the listview. " itm.ForeColor = vbRed"
the below subitems how to change the font to red color too?
anyone can assist?
i tried below code does work
Me.ListView1.ListItems.Add.SubItems(1).ForeColor = vbRed
itm.SubItems.ForeColor = vbRed