-2

I am trying to create a excel form with text and combo boxes using VBA where the data I enter in the form should get saved in a different worksheet. There should be a save button on the form for users to click on it so that the data gets saved. Is that possible. please help

Community
  • 1
  • 1
Anand
  • 5
  • 3

2 Answers2

0

It's certainly possible, can you be more specific about what part you're having a problem with?

The general timeline of events would be this:

  1. Create UserForm and add textboxes, comboboxes and save button. a. To learn how to populate comboboxes, check out these resources: How to add items to a combobox in a form in excel VBA?

  2. Give each of your textboxes, comboboxes and save button a name in properties, so that they can be referenced in the code.

  3. Add code to the Save Button event. To do this, go to your UserForm and double click on the Save Button, this will bring you to the code that will execute when that button is clicked, you'll be adding something like this:

    Sheets("Example").Range("A1").Value = textbox.Value

Community
  • 1
  • 1
kevfefe
  • 41
  • 8
  • thank you :) Somehow managed to create a form :) However I ma trying to list down the combox values over an array. in my code if I give multiple arrays it throws me an error . below is my code. where if I uncomment the third array it says permission denied. just accepts the first two entries. I have like 10 combo boxes. – Anand Sep 06 '16 at 05:39
  • Private Sub UserForm_Initialize() scenariotype.List = Array("Happyscenario", "Alternative", "Exception") preparedby.List = Array("Savio", "sutharsan", "Shaji") 'Testtypeselection.List = Array("Provisioning", "Functional", "Billing", "Reports") 'TestingPhase1.List = Array("UAT", "Production") 'Status.List = Array("Pass", "Failed", "InProgress", "Blocked", "NoRun", "NotExecutable") 'scenariotype.AddItem "Happy Scenario" ' scenariotype.AddItem "Alternative" ' scenariotype.AddItem "Exceptions" End Sub – Anand Sep 06 '16 at 05:41
  • Hey, two things: - Use the code blocks when you post code on here, when I copy and paste that code in your previous comment it's all on one line and impossible to read. People are happy to help, and I'd be happy to help in this case but it makes it much easier if the code is easily readable. - If someone, in this case me, gives an answer that answers your original question, you should accept that answer so that other people see the question has been answered and so that my reputation score is helped. – kevfefe Sep 06 '16 at 19:49
  • my bad. Will make sure code is added accordingly in future. and thank you so much for helping out. – Anand Sep 08 '16 at 13:13
0

To answer your comment:

You shouldn't have any problem adding arrays to Comboboxes like this:

Private Sub UserForm_Initialize()
    ComboBox1.List = Array("One", "Two", "Three")
    ComboBox2.List = Array("Four", "Five", "Six")
    ComboBox3.List = Array("Seven", "Eight", "Nine")
End Sub

If you're having issues, make sure your code, in this case "ComboBox1... etc." is referring to Comboboxes that exist.

kevfefe
  • 41
  • 8