show the colored value of specific column in lastview

0

hi, everybody 

i have sheet1 contains data  and contains column d  colored value  i would show  colored value in listview

Answer
Discuss

Answers

0

here is a snippet of code to get you started.

there will need to be a bit more logic added to set up the colours you want 

'Count number of columns in source range
colCount = rngData.Columns.Count

'Now we fill our ListView
For i = 2 To rowCount
Set listItem = Me.ListView1.ListItems.Add(Text:=rngData(i, 1).Value)
For j = 2 To colCount
listItem.ListSubItems.Add Text:=rngData(i, j).Value
If j = 4 Then
    listItem.ListSubItems.Item(3).ForeColor = vbRed
End If

I have added the xl with the code in it. 

From the macro editor select the form then right mouse click on it to show the code

Discuss

Discussion

thanks for your replaying   but, i don't know where exactly put tis code which event 
 i try putting this code  in these events  it doesn't work
Private Sub ListView1_BeforeLabelEdit(Cancel As Integer)   Private Sub UserForm_Initialize()

leopard (rep: 6) Aug 12, '19 at 6:55 am
I have just updated the file with additional code to give you a bit of flexibility in the colours using  case statements
k1w1sm (rep: 122) Aug 14, '19 at 6:32 pm
Add to Discussion

Answer the Question

You must create an account to use the forum. Create an Account or Login