![]() |
#1
|
|||
|
|||
![]()
Hi
Please advice... My macro have a ListBox on the form. ListBox contains 3 columns and 10 rows. 3*10 = 30 cells Is it possible to display the data in some cells in a different color? (Red or blue) |
#2
|
|||
|
|||
![]()
I don't think so but you may use this code:
Code:
Private Sub UserForm_Click() Dim intIndex As Integer With ListBox1 .Clear .AddItem Space(4) & "Samp1" .AddItem Space(4) & "Samp2" .AddItem Space(4) & "Samp3" .AddItem Space(4) & "Samp4" End With Randomize End Sub Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Dim intIndex As Integer intIndex = ListBox1.ListIndex ListBox1.List(intIndex) = "• " & Trim(ListBox1.List(intIndex)) End Sub Private Sub Listbox1_Click() Dim intIndex As Integer Dim r, g, b As Integer r = Rand(0, 255) g = Rand(0, 255) b = Rand(0, 255) ListBox1.ForeColor = RGB(r, g, b) End Sub Public Function Rand(ByVal Low As Long, ByVal High As Long) As Long Rand = Int((High - Low + 1) * Rnd) + Low End Function This code will change color of all fonts written inside listbox. Maybe in X5 in VSTA you will be able to do more. To use different colors inside listbox you will need different item then normal listbox or maybe Visual Studio 6. |
#3
|
|||
|
|||
![]()
Thank you very much, it greatly aided me.
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
ListBox table | shark | Macros/Add-ons | 3 | 10-12-2010 15:43 |
How can i .additem in listbox? | Kursad | CorelDRAW/Corel DESIGNER VBA | 1 | 16-07-2009 03:08 |
Listbox Control with images ? | hschneider | CorelDRAW/Corel DESIGNER VBA | 4 | 18-03-2008 07:28 |
ListBox with ColumnHeads | fadimas | CorelDRAW/Corel DESIGNER VBA | 0 | 20-03-2007 04:43 |
shape-names in listbox | Seelenquell | Code Critique | 5 | 14-02-2006 13:12 |