User Form Help Please

mercmannick

Well-known Member
Joined
Jan 21, 2005
Messages
730
Hi

i would like to create a userform with a textbox to enter a product code , a command button to run VBA and a big text box to show output of VBA from Textbox 1 which i will connect to DB and pull back information relevant to that product code , is this possible i can create the userform no problem and already have code to pull back from DB into Excel , can anyone give me a idea how to do this if its atall possible

Thanks

Nick
 
hiya Norie i have been messing with column widths , yes One thing though isn't ssSQL the string for the SQL code? it is , so i mean results again :), the text on column 2 in listbox is anything upto 350 characters long , i would love to hide and only show first 100 or so and if they dbl click line it will show full code in another listbox / userform etc

Many thanks

Nick
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Nick

I don't think you quite understand what I'm suggesting.

Hide the whole column.

Or must the user see the data in the listbox?
 
Upvote 0
Nick

But do you need to see them in the listbox?

You can easily set it up so that when an item in the listbox is selected all the data is shown elsewhere on the userform or as you suggested yourself on another form.

What is it you are actually trying to do?

I mean the overall picture of what functionality you are trying to provide for the user?
 
Upvote 0
Hi Norie

The userforma contains 3 columns , col 1 being cw no which is unique to that product, col 2 is route details , and col 3 is hours .

at moment i am showing all 3 in uerform which is fantastic , but if someone needs to drill into text on route details to see full text i need it to show full text , i dont mind if its same form difrrent form or anything just the ability to see full text of column 2

Thanks for your help

Nick
 
Upvote 0
Norie, am i looking on right tracks with this , but after dbl click userform2 dosent show

Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Integer
    If ListBox1.ListIndex = -1 Then Exit Sub
        For i = ListBox1.ListCount - 1 To 0 Step -1
    If ListBox1.Selected(i) = True Then
    Load UserForm2
        UserForm2.ListBox2.AddItem ListBox1.List(i)
        
            End If
        Next i

End Sub

Thanks

Nick
 
Upvote 0
Norie, am i looking on right tracks with this , but after dbl click userform2 dosent show

Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Integer
    If ListBox1.ListIndex = -1 Then Exit Sub
        For i = ListBox1.ListCount - 1 To 0 Step -1
    If ListBox1.Selected(i) = True Then
    Load UserForm2
        UserForm2.ListBox2.AddItem ListBox1.List(i)
        
            End If
        Next i

End Sub

Thanks

Nick
You forgot to add UserForm2.Show

Load UserForm2
UserForm2.ListBox2.AddItem ListBox1.List(i)
UserForm2.Show

Arc
 
Upvote 0
Thanks Arc, this works and shows userform , but is only showing me Col 1 of list box can i show just Col 2 of listbox1 or all of selected row

Thanks

Nick
 
Upvote 0
Code:
rivate Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Integer
Dim vList As Variant
    If ListBox1.ListIndex = -1 Then Exit Sub
        For i = ListBox1.ListCount - 1 To 0 Step -1
    If ListBox1.Selected(i) = True Then
        ListBox1.Selected(i) = vList
            vList = Application.WorksheetFunction.Transpose(vList)
    UserForm2.ListBox2.AddItem vList 'ListBox1.List(i)
    UserForm2.Show
       
            End If
        Next i

End Sub

Even trying to transpose data is ojnly giving me a 0 now .

Thanks

Nick
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,842
Members
449,471
Latest member
lachbee

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