Posts by chester1993

    What do you mean with "which type of Command Button I am using"?

    I create my command button on userfom using the pop-up ToolBox. Is there any other kind of Command Button? I know there are Form controls and ActiveX button. I assume the button inside VBA is always ActiveX, right?

    Uhm. I have another problem. So, I tried to copy your code on the worksheet I am working on. When I click on the command button, its not doing anything, for some weird reason. I changed the below code to the caption of the command button. Is there anything else I need to change aside from this that I am missing? I already have a "call" code on the command button. So, not sure what I am missing. I just copy it as it is.

    1. Case "Google": LaunchIE ""

    you are heaven sent, royUK . Thank you!

    For future references, the 1st set of codes you gave me usually works if the command buttons are in a sheet and not in a UserForm, right?

    I also noticed that, on the 1st set of code, you mention that I need to paste them on a MODULE. The 2nd set, I noticed that the codes were pasted on the UserForm instead of a module.


    Disclaimer: This is my second question for today. I created a separate thread for this to avoid confusions on the answer.

    Anyhow. As the title says, I have UserForm active on Sheet 1 used for Data Entry. I want to open another sheet within the same workbook, Sheet 2, but I don't want to close the current UserForm.

    Is there any way to do that?

    Thank you in advance!

    Hello All,

    I have a macro below that allows me to open a hyperlink on a different browser. I have assigned this code to a command button (the next set of code). My issue right now is how do I modify this macro so I can assign different websites on different command buttons. For instance, the below website is assigned to CommandButton1. I have CommandButton2 who wants to open (example only). Please take note, I will be assigning multiple websites on different command button. So, it's 1 website per command button.

    1. Sub LaunchIE()
    2. Dim IE As Object
    3. Set IE = CreateObject("InternetExplorer.Application")
    4. IE.navigate ""
    5. IE.Visible = True
    6. Set IE = Nothing
    7. End Sub
    1. Private Sub CommandButton1_Click()
    2. Call LaunchIE
    3. End Sub

    Thank you in advance to anyone who can help me.

    Replace the code in my last example with this

    Thank you, royUK and Justin Doward .

    I'll try this new code and let you guys know.

    This example uses a TextBox

    I'm still not sure what happens if the second selection in the combobox is selected.

    For the second option in the combox box, technically, they function the same as the 1st option. For instance,

    Selecting the 1st option displays:

    • Address Required

    • Need POA

    • Need Bank Statement

    Selecting the 2nd option displays:

    • Country Required

    • Need Passport

    • Need POI

    Also, from your work, is there any chance it would appear just like how it appears on the above example?

    If you use this approach you pretty much have to build the entire text each time, clear the box using the me.textbox1.text = vbnullstring and then add a line to check checkbox1, 2 and 3 in order and build the text as required. You will need to do the same for the combobox.

    bare with me on this one, as I try to comprehend it. lol

    When you gave me the below code, does that mean I literally just paste it under Checkbox1_Click? and, just replace Me.CheckBox4.Value to the other check boxes?

    1. Private Sub CheckBox1_Click()
    2. Me.TextBox1.Text = vbNullString
    3. If Me.CheckBox1.Value = True Then
    4. Me.TextBox1 = Label1.Caption & vbNewLine & CheckBox1.Caption
    5. If Me.CheckBox4.Value = True Then Me.TextBox1.Text = Me.TextBox1.Text & vbNewLine & Me.CheckBox4.Caption
    6. If Me.CheckBox5.Value = True Then Me.TextBox1.Text = Me.TextBox1.Text & vbNewLine & Me.CheckBox5.Caption
    7. End If
    8. End Sub

    Hey royUK .

    I did check your work first.

    This UserForm is supposed to be a simple user form in creating a "Note Generator" for work. I thought having this would give me an easier time at work.

    I have 2 columns of check boxes because I want 1 column for Documents Received and 1 column for Documents Needed (To be requested). This way, I would have a sort of checklist of what I need to ask from clients. So, in a sense, it is very important for me to have 2 columns.

    For the combo box, I admit I am unsure if this is right "function" to use here. I am not gonna do multiple selection, I will only choose one from the list. As I stated above, upon selecting an option from the box, I want that same text be displayed on textboxt1 along with another 2-liner.

    For the copy, I only want it on my clipboard and I'll post it somewhere in my system (outside excel) like Notepad or something. The below is my code for copying the text. Correct me if I am wrong.

    1. ' ' Copy Text from TextBox
    2. Private Sub CommandButton1_Click()
    3. With New MSForms.DataObject
    4. .SetText TextBox1.Text
    5. .PutInClipboard
    6. End With
    7. End Sub

    Since I am a newbie in this. I thought the code of Justin Doward is "easier" for me to understand. Though, I have only tested the checkboxes for now. With that, I want to add another query here. I have this code so far:

    My problem here is, after un-ticking check box 2, it is not "removed" on the textbox. It stays on the textbox and when I click again on the same checkbox, the same texts was doubled. I added the below code on Checkbox2, but it didn't do any better.

    1. Me.TextBox1.Text = vbNullString

    Hello again,

    Thank you again royUK for your work. I have seen it and I have attached my sample worksheet here for proper reference.

    Here's what I am trying to accomplish.

    1. I am hoping the "caption" of the Checkbox be displayed to textbox.

    2. I am hoping the "label", which is "Received" and "Required", be displayed on the textbox as well once I choose an option via Checkbox.

    3. The texts displayed on the textbox must be displayed on how the options are displayed on the UserForm. For instance, under Received, Name comes as first, then address, etc.

    4. On the ComboBox, there are 2 options. I want to display these options, once selected, on the textbox and add 2 more lines of text. FOr instance, the 1st option is Address Required. I want to show the following texts:

    Address Required

    • Bank Statement

    • Utility Bill

    5. There should be a copy and clear button, but I already have that figured out, at least.

    I know this is all too much, I appreciate all your help guys.


    • Sample.xlsm

      (21.37 kB, downloaded 33 times, last: )