Auto Highlight selected field on userform

cmxulb

Board Regular
Joined
Nov 24, 2020
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Hello,
How can you auto higlight selected field on userform?

So basicly I need this line to be highlighted (Me.lstDatabase.TopIndex = Me.lstDatabase.ListCount - 1)


ListBox1.BackColor = RGB(153, 153, 255) ??????
VBA Code:
[CODE=xls]
[/CODE]
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hello,
How can you auto higlight selected field on userform?

So basicly I need this line to be highlighted (Me.lstDatabase.TopIndex = Me.lstDatabase.ListCount - 1)


ListBox1.BackColor = RGB(153, 153, 255) ??????
 
Upvote 0
What exactly are you trying to do?
If you just want to select the last item try
VBA Code:
   Me.ListBox1.ListIndex = Me.ListBox1.ListCount - 1
 
Upvote 0
Selecting the last item is working, I would like to have it highlighted to this color BackColor = RGB(153, 153, 255)
What exactly are you trying to do?
If you just want to select the last item try
VBA Code:
   Me.ListBox1.ListIndex = Me.ListBox1.ListCount - 1
,
 
Upvote 0
Do you mean you want to change the highlight colour for the selected item?
 
Upvote 0
Do you mean you want to change the highlight colour for the selected item?
How can I add this code BackColor = RGB(153, 153, 255 to this code Me.ListBox1.ListIndex = Me.ListBox1.ListCount - 1
 
Upvote 0
How can I add this code BackColor = RGB(153, 153, 255 to this code Me.ListBox1.ListIndex = Me.ListBox1.ListCount - 1
it is selecting the last item entered but is not highlighted
 
Upvote 0
Can you please answer my question?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top