Userform Tool Like the properties explorer

nightcrawler23

Well-known Member
Joined
Sep 24, 2009
Messages
721
Hi all,
I have a question regarding the userform controls. Do we have a control like the properties explorer of the visual basic editor.I have a question regarding the userform controls. Do we have a control like the properties explorer of the visual basic editor.

Basically i need to display a list of items on the userform and allow users to edit the corresponding values just beside it. Just like we do in the properties explorer. do we have any such control? or is their some way i can do this?asically i need to display a list of items on the userform and allow users to edit the corresponding values just beside it. Just like we do in the properties explorer. do we have any such control? or is their some way i can do this?

I hope i made myself clear.:confused:
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
This seems very possible.

However no advanced control I am aware of exists to simplify the task.

Many controls (labels, drop-downs, etc.) and code for each activeX could acheive your goal.
 
Upvote 0
This uses a listbox and a frame containing a text box.

The listbox and text box have the same Font name and size
Some of the constants in this code need to be adjusted for your choice in font size etc.

Code:
Private Sub UserForm_Initialize()
    With ListBox1
        .ColumnCount = 2
        .ColumnWidths = "100;"
        Rem add test data
        .AddItem "Name": .List(0, 1) = "Mike"
        .AddItem "Address": .List(1, 1) = "123 West St."
        .AddItem "Occupation": .List(2, 1) = "Worker"
        .AddItem "Nickname": .List(3, 1) = "Hansome Devil"
        
        Rem put list box behind frame1
        .ZOrder 1
        .ListIndex = 0
    End With
    
    Rem format frame and textbox
    With Frame1
        .BackColor = ListBox1.BackColor
        .BorderStyle = fmBorderStyleNone
        .SpecialEffect = fmSpecialEffectFlat
        .Height = 16
        .Width = ListBox1.Width - 100 - 9
        .Left = ListBox1.Left + 100 + 7: Rem 100 from Listbox1.ColumnWidths, adjust 7 as needed
    End With
    With tbxEntry
        Rem tbxEntry is in Frame 1
        .Left = 0: .Top = 0
        .BackStyle = fmBackStyleTransparent
        .SpecialEffect = fmSpecialEffectFlat
        .SelectionMargin = False
        .BorderStyle = fmBorderStyleSingle: Rem set to taste
    End With
End Sub

Private Sub ListBox1_Click()
    With ListBox1
        If -1 < .ListIndex Then
            Frame1.Top = .Top + (.ListIndex * 15): Rem adjust to font size
            Frame1.Visible = True
            Call TBtoLB
            tbxEntry.Text = .List(.ListIndex, 1)
            tbxEntry.Tag = .ListIndex
        End If
    End With
End Sub

Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Frame1.Visible = True
    tbxEntry.SetFocus
End Sub

Private Sub Frame1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Call TBtoLB
    Frame1.Visible = False
End Sub

Sub TBtoLB()
    With tbxEntry
        If IsNumeric(.Tag) Then
            ListBox1.List(Val(.Tag), 1) = .Text
        End If
    End With
End Sub
 
Last edited:
Upvote 0
Thank you all for your replies. I managed to solve my problem by having a listbox to show the list and corresponding values and a textbox which will allow the user to change the value of the selected item.

@mikerickson,
Thanks a lot for your effort. Awesome walk-through the problem. Will surely try this way just to learn.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

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