• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Userform Data saved into a specific sheet

Kmahraz

Member
Hello All!
Since joining Chandoo I had great experience and the members always offered help and assistance when need, so I am great-full to all those that assisted with my little project. Anyway, I really can use some help to get my project moving.

The userform consist of two tabs at this time, the first tab titled " Customer Info" work perfectly and the data get saved properly into sheet titled "Customer Info".

For the second tab I can use your help :
  1. I need the data saved into sheet titled "Cost Data" in the layout that's shown in my example file. Note: Customer ID is the same in both sheets. In general the user will create a case and a unique customer ID get generated automatically each time they make an entry.
  2. I have multiple comboboxes in a userform, each of which contained the same items, A1 through A11. What I need is that when the user selected an item in any of the comboboxes, that item would become unavailable in all of the other comboboxes.
  3. You will notice that there are 3 checkboxes, these boxes activate the textboxes in the tab titled "Cost Data". I would like to have the data saved only for when the fittings group 1,2 or 3 checkboxes is checked. There will be always only one of the 3 scenarios shown below:
    1. Fittings 1 VS Fittings 3
    2. Fittings 2 VS Fittings 3
    3. Fittings 1 VS Fittings 2 VS Fittings 3
All data will need to be saved when the Add button is pressed.

Please Let me know if there are any questions.
Regards,
K
 

Attachments

  • CHANDOO-Test file .xlsb
    371.8 KB · Views: 12
Any help please, I really need to get this little project moving and I can use any help I can get.
:rolleyes::rolleyes::rolleyes::rolleyes::rolleyes::(:rolleyes::rolleyes::rolleyes::rolleyes::rolleyes:
 
Hi !

1. As you already have code to save first tab data,
why don't you continue for second tab, what's the difficulty ?

3. You can check if fisrt combobox Enabled property is True to save …
 
Hello Marc,
Thank you for the suggestions, I tried but failed, I have learned VBA in the past 2002 but never had a chance to use it till recently, so I am doing a lot of reading and learning from all members and the sites and this is one of my project that will help my team significantly if done right.

As you said there are several ways to achieve this, so I am looking for your expertise to help me choose the optimum solution.

If you can please provide me with an overview or how the code may look like that will help with Q1, Q2 and Q3, and I will drive it from there.
Finally, I hope you had a great party lastnight, for me I had a chance to go and watch the cavaliers against the Magics


Regards,
K:)
 
Last edited:
Great party last night, great headache today !

With this kind of stuff, I never use an UserForm, easier to directly use cells …

To save second tab, you can test if first combobox is enabled :​
Code:
If ComboBox1name.Enabled Then
    ' code to save here
End If
Test that first with a Beep or a MsgBox as code to save
 
All-
I was able to get my first question solved, using the code below.
The code does cover portion of the second tab in the user form...but you get the idea....there are several code duplicated with minor changes.
:p:oops::DDI know this is not the most optimum solution but it does meet my need.

Is it possible to add/ change my code below to check if there are no duplication in Customer ID column A sheet titled "Cost Data" first before the data get entered into the sheet. If it find a duplication it will provide an error note....

Or the add button will be enabled only one time the user form is run

For the third question the code I created using the checkboxes and enabling the other textboxes and the combboboxes does meet my need I guess.

If I can get help with my second question that will be great and will enable me to get my project moving forward.

Code:
Private Sub CommandButton4_Click()
i& = Sheet5.Cells(Rows.Count, "F").End(xlUp).Row + 2
Sheet5.Range("A" & i) = Sheet1.Range("M" & Sheet1.Cells(Rows.Count, "M").End(xlUp).Row)
Sheet5.Range("B" & i) = Me.MultiPage1.Pages("Page2").cboWSSystem.Value
Sheet5.Range("C" & i) = Me.MultiPage1.Pages("Page2").cboWUnit.Value
Sheet5.Range("D" & i) = Me.MultiPage1.Pages("Page2").cboWCurrency.Value
Sheet5.Range("E" & i) = Me.MultiPage1.Pages("Page2").cboWMaterial.Value
Sheet5.Range("F" & i) = Me.MultiPage1.Pages("Page2").cboCategory1.Value
Sheet5.Range("F" & i + 1) = Me.MultiPage1.Pages("Page2").cboCategory2.Value
Sheet5.Range("F" & i + 2) = Me.MultiPage1.Pages("Page2").cboCategory3.Value
Sheet5.Range("F" & i + 3) = Me.MultiPage1.Pages("Page2").cboCategory4.Value
Sheet5.Range("F" & i + 4) = Me.MultiPage1.Pages("Page2").cboCategory5.Value
Sheet5.Range("F" & i + 5) = Me.MultiPage1.Pages("Page2").cboCategory6.Value
Sheet5.Range("F" & i + 6) = Me.MultiPage1.Pages("Page2").cboCategory7.Value
Sheet5.Range("F" & i + 7) = Me.MultiPage1.Pages("Page2").cboCategory8.Value
Sheet5.Range("F" & i + 8) = Me.MultiPage1.Pages("Page2").cboCategory9.Value
Sheet5.Range("F" & i + 9) = Me.MultiPage1.Pages("Page2").cboCategory10.Value
Sheet5.Range("G" & i) = Me.MultiPage1.Pages("Page2").TxtWPN1.Value
Sheet5.Range("G" & i + 1) = Me.MultiPage1.Pages("Page2").TxtWPN2.Value
Sheet5.Range("G" & i + 2) = Me.MultiPage1.Pages("Page2").TxtWPN3.Value
Sheet5.Range("G" & i + 3) = Me.MultiPage1.Pages("Page2").TxtWPN4.Value
Sheet5.Range("G" & i + 4) = Me.MultiPage1.Pages("Page2").TxtWPN5.Value
Sheet5.Range("G" & i + 5) = Me.MultiPage1.Pages("Page2").TxtWPN6.Value
Sheet5.Range("G" & i + 6) = Me.MultiPage1.Pages("Page2").TxtWPN7.Value
Sheet5.Range("G" & i + 7) = Me.MultiPage1.Pages("Page2").TxtWPN8.Value
Sheet5.Range("G" & i + 8) = Me.MultiPage1.Pages("Page2").TxtWPN9.Value
Sheet5.Range("G" & i + 9) = Me.MultiPage1.Pages("Page2").TxtWPN10.Value
Sheet5.Range("H" & i) = Me.MultiPage1.Pages("Page2").TxtWC1.Value
Sheet5.Range("H" & i + 1) = Me.MultiPage1.Pages("Page2").TxtWC2.Value
Sheet5.Range("H" & i + 2) = Me.MultiPage1.Pages("Page2").TxtWC3.Value
Sheet5.Range("H" & i + 3) = Me.MultiPage1.Pages("Page2").TxtWC4.Value
Sheet5.Range("H" & i + 4) = Me.MultiPage1.Pages("Page2").TxtWC5.Value
Sheet5.Range("H" & i + 5) = Me.MultiPage1.Pages("Page2").TxtWC6.Value
Sheet5.Range("H" & i + 6) = Me.MultiPage1.Pages("Page2").TxtWC7.Value
Sheet5.Range("H" & i + 7) = Me.MultiPage1.Pages("Page2").TxtWC8.Value
Sheet5.Range("H" & i + 8) = Me.MultiPage1.Pages("Page2").TxtWC9.Value
Sheet5.Range("H" & i + 9) = Me.MultiPage1.Pages("Page2").TxtWC10.Value
Sheet5.Range("I" & i) = Me.MultiPage1.Pages("Page2").TxtWQ1.Value
Sheet5.Range("I" & i + 1) = Me.MultiPage1.Pages("Page2").TxtWQ2.Value
Sheet5.Range("I" & i + 2) = Me.MultiPage1.Pages("Page2").TxtWQ3.Value
Sheet5.Range("I" & i + 3) = Me.MultiPage1.Pages("Page2").TxtWQ4.Value
Sheet5.Range("I" & i + 4) = Me.MultiPage1.Pages("Page2").TxtWQ5.Value
Sheet5.Range("I" & i + 5) = Me.MultiPage1.Pages("Page2").TxtWQ6.Value
Sheet5.Range("I" & i + 6) = Me.MultiPage1.Pages("Page2").TxtWQ7.Value
Sheet5.Range("I" & i + 7) = Me.MultiPage1.Pages("Page2").TxtWQ8.Value
Sheet5.Range("I" & i + 8) = Me.MultiPage1.Pages("Page2").TxtWQ9.Value
Sheet5.Range("I" & i + 9) = Me.MultiPage1.Pages("Page2").TxtWQ10.Value
End Sub
 
Last edited:
Please find the attached updated file where I have implemented the requirement specified on the first post..
 

Attachments

  • CHANDOO-Test file .xlsb
    342.8 KB · Views: 15
Back
Top