none
Excel 2013 VBA Code gets stuck but continues smoothly when F5 is pressed RRS feed

  • Question

  • I have a userform by the name Q11

    This form is called from another form (Questions by clicking on a button)

    Q11.show

    Then I get an error stating Run time error '380'

    Could not set the Text Property. Invalid Property Value

    In my Q11 form I have a userform_initialize function

    with the following code

    File = "Budget.xlsm"

    Windows(File).Activate
    Sheets("Question11").Select

    txtbox_mem1.Text = Cells(2, 2).Value   /' I am assigning text box value from an excel sheet
    comboq11_fund_mem1.Text = Cells(2, 3).Value   /' I am assigning combo box value from an excel sheet
    txtbox_mem2.Text = Cells(2, 4).Value   /' I am assigning text box value from an excel sheet
    comboq11_fund_mem2.Text = Cells(2, 5).Value /' I am assigning combo box value from an excel sheet.

    When I debugged the code the error is on the line where I am assigning the combo box value....However when I press F5 (just press F5 and do nothing) the code works fine.

    Could you help me on this


    Regards, Hitesh

    Wednesday, February 4, 2015 9:13 PM

Answers

All replies

  • This worked for me... though you may want to use values that are in the list already, along the lines of

    Me.comboq11_fund_mem1.Text = Me.comboq11_fund_mem1.List(1)

    Private Sub UserForm_Initialize()
        Dim strFile As String
        strFile = "Budget.xlsm"
        
        With Workbooks(strFile).Sheets("Question11")
            Me.txtbox_mem1.Text = .Cells(2, 2).Value   ' I am assigning text box value from an excel sheet
            Me.comboq11_fund_mem1.Text = .Cells(2, 3).Value   ' I am assigning combo box value from an excel sheet
            Me.txtbox_mem2.Text = .Cells(2, 4).Value   ' I am assigning text box value from an excel sheet
            Me.comboq11_fund_mem2.Text = .Cells(2, 5).Value ' I am assigning combo box value from an excel sheet.
        End With
    End Sub


    Thursday, February 5, 2015 3:28 PM
  • Hi Hitesh,

    What’s the value of Cells(2,3)?

    Since we can’t reproduce that issue, could you share a sample file that could reproduce that issue on the OneDrive?

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 6, 2015 9:22 AM
    Moderator
  • Hi Starain,

    The code gets stuck when the Cell (2,3) has a blank value in it.

    Also if I use Me.comboq11_fund_mem1.Text = .Cells(2, 3).Value  for a combo box then the combo box drop down does not show other values


    Regards, Hitesh

    Monday, February 9, 2015 11:54 PM
  • Hi Hitesh,

    Base on my test, I can set blank value to Combo box’s Text property.

    Could you share a sample project on the OneDrive?

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 10, 2015 3:16 AM
    Moderator
  • Hi,

    Do you solved your issue? Anything update will be appreciated.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 13, 2015 3:31 AM
    Moderator
  • Hi Starain,

    I changed the entire logic of my code and the problem is now resolved....Sorry for the late reply....Thanks a lot for your help


    Regards, Hitesh

    Friday, February 13, 2015 6:06 PM