Hello,
Hope you can assist with solving this:
I would like to make the Price column in the ListView display the values with the 3 digit comma separation and ending with 2 decimal places (#,###.00)
I had tried many ways that I found online, but due to the format in which my code add the items in the listView, I am unable to figure out how to achieve this.
Thanks a lot
Sub LoadData()
Dim li As ListItem
Dim lngRow As Long
Dim lngSub As Long
Dim lngLastRow As Long
Dim wks As Worksheet
Set wks = Sheet2
Dim ch As ColumnHeader
SetCommonListViewProperties ListView1
With ListView1.ColumnHeaders
Set ch = .Add(, , "CODE", 55, lvwColumnLeft)
Set ch = .Add(, , "PART NO.", 77)
Set ch = .Add(, , "TYPE 2", 67)
Set ch = .Add(, , "PRICE", 77, lvwColumnRight)
Set ch = .Add(, , "FAMILY", 85)
Set ch = .Add(, , "BRAND", 70)
Set ch = .Add(, , "NOTE", 70)
End With
With wks
lngLastRow = wks.Cells(.Rows.Count, "D").End(xlUp).Row
End With
For lngRow = 9 To lngLastRow
With Me.ListView1
Set li = .ListItems.Add(Text:=wks.Cells(lngRow, "D").Value)
For lngSub = 5 To 11
li.ListSubItems.Add Text:=wks.Cells(lngRow, lngSub).Value
Next lngSub
End With
Next lngRow
If Len(wks.Cells(9, "D").Value) = 0 Then
MsgBox "No matching data"
End If
End Sub
Bookmarks