Userform Listbox

johnohio

New Member
Joined
May 12, 2005
Messages
48
Office Version
  1. 2016
Platform
  1. Windows
I am working on a userform with a listbox of 2 items.. Cash In and Cash Out.
It works OK but the Cash In has dotted lines around it.

I have never seen this before. How do I get rid of the dotted lines?

Thanks Everyone



VBA Code:
Private Sub UserForm_Initialize()
   
    With UserForm1.ListBox1
        .AddItem "Cash In/Income  "
        .AddItem "Cash Out/Expense"
   End With

End Sub
 

Attachments

  • p1.GIF
    p1.GIF
    4.9 KB · Views: 5
  • p2.GIF
    p2.GIF
    4.5 KB · Views: 5

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
@johnohio
I just want to comment on something, if the purpose of the listbox is to select an item from a list then using a combobox is more suitable.
 
Upvote 1
Solution
That's because "In" is the first record in the listbox.

1688177624176.png


And it is dotted as the number 1 item in the listbox. To identify the cursor in the listbox.

If you had another control, for example a textbox, and the cursor was in the textbox, then the listbox would not present that dotted box.

1688177779667.png
 
Upvote 0
You're welcome, glad to help & thanks for the feedback.:)
 
Upvote 0

Forum statistics

Threads
1,216,038
Messages
6,128,450
Members
449,453
Latest member
jayeshw

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