New Userform

Halos

New Member
Joined
Feb 14, 2015
Messages
34
Dear All,

Could you please help me to create new Userform and including combobox which I can filter and select material name (material names need to be took from any excel sheet) and when I click ok then this need to be saved "account" sheet (each time need insert new row). Textbox1 will be "date" (01/01/2018).

I appreciate your help.
Just created macro but cannot work:(

Code:
[LEFT][COLOR=#333333][FONT=monospace]Private Sub CommandButton1_Click()
If ComboBox1 = vbNullString Or TextBox1 = vbNullString Or Then
MsgBox "Please add date"
Else
      
      Sheets("account" + ComboBox1.Value).Rows(6).Insert
      
      Sheets("account" + ComboBox1.Value).Range("C6") = TextBox1
      
      
     Unload UserForm1
      End sub[/FONT][/COLOR][/LEFT]
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi,
Do you know how to create a new UserForm?

Do you really need a combobox or just a textbox?
 
Upvote 0
Dear Gregm66,

Yes, I know how to create userform but cannot add command to add dropdown list which take list of materials from the excel sheet and when I select one of the material name, it should be automatically saved any sheet (for example sheet1) and when saved in the row it should be inserted new row.

Thanks you for helping me.
 
Upvote 0
Dear Gregm66,

Yes, I will create new sheet (for example, sheet name is materials) and add material names to that sheet range A1:A100.
 
Upvote 0
Halos,

I use a combobox in one of my useforms, i go to the propertys menu for that combobox, then set row source to match the named range that i gave to that particular list. that will load the combo with that list. or
as follows using code.

Code:
'Private Sub Combobox1_Change()
'Me.combobox2 = ""
'Select Case Me.combobox1
    'Case "Movies"
        'Me.combobox2.RowSource = "Movies"
    'Case "Music"
        'Me.combobox2.RowSource = "Music"
    'Case Else
        'do nothing
'End Select
'End Sub

see if this helps you.
 
Upvote 0
I have just copied above code and created new userform and added combobox. Can I set the row source like Music!A1:B5 (or I can set only 1 column?)?

I have created new sheets named Music and Movies. I added some music names with numbers (for example, Music name "love me" in range A1 and number "5" in range B1). I am so sorry, the main logic is when I select one of the music name from the list (from the row source) and click on the button in the userform then this need to be copied to the "Music" sheet with the inserting new row. I copied below code but still it is not working. Could you please help me. Thanks in advance.

Code:
Private Sub Combobox1_Change()
'Me.combobox2 = ""
'Select Case Me.combobox1
    'Case "Movies"
        'Me.combobox2.RowSource = "Movies"
    'Case "Music"
        'Me.combobox2.RowSource = "Music"
    'Case Else
        'do nothing
'End Select
'End Sub



Private Sub CommandButton1_Click()
If ComboBox1 = vbNullString Or ListBox1 = vbNullString Or Then
MsgBox "Please add date"

MsgBox "Please add date"
Else
      
      Sheets("Music" + ComboBox1.Value).Rows(6).Insert
      
      Sheets("Music" + ComboBox1.Value).Range("C6") = ListBox1
      
      
     Unload UserForm1
      End Sub


Private Sub ListBox1_Click()
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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