Hello all,
I have an Userform which starts up when Workbook is open, and the workbook gets minimized.
Userform is show modeless so other open workbooks could be handled
The Userform consist of a MultiPage with a few tabs, on which each has some comboboxes, textboxes and listboxes
They are all connected to the workbook one way or another, either getting the value from a cell with a formula, or putting a value in other cell, getting rowsourse from named range, handling the ranges via copying, etc..
An example of one of such codes
I've tried with this
The error I mostly get is out of the range when it tries to deal with a cell in any way.
All of that works fine if workbook stays active in the background or if it is the only open workbook in the application
As soon as other workbook is activated, userform breaks as it can't get the source for it's objects
Any way to avoid and bypass this?
Thank you
I have an Userform which starts up when Workbook is open, and the workbook gets minimized.
Userform is show modeless so other open workbooks could be handled
Code:
Private Sub Workbook_Open()ActiveWindow.WindowState = xlMinimized
Workbooks("New BOM Maker Userform.xlsm").Activate
UserForm1.Show vbModeless
End Sub
They are all connected to the workbook one way or another, either getting the value from a cell with a formula, or putting a value in other cell, getting rowsourse from named range, handling the ranges via copying, etc..
An example of one of such codes
Code:
Private Sub ComboBox3_Change()
With Workbooks("Userform.xlsm")
Workbooks("Userform.xlsm").Sheets("Order").Range("B4") = Me.ComboBox3.Value
If ComboBox3 = "Split" Then
ComboBox10.Visible = True
ComboBox11.Visible = True
Me.Width = 495
MultiPage1.Width = 475
ComboBox4.Value = "8"
Else
ComboBox10 = ""
ComboBox11 = ""
ComboBox10.Visible = False
ComboBox11.Visible = False
MultiPage1.Width = 372
Me.Width = 395
If ComboBox3 = "Offset" Then
ComboBox8 = ""
ComboBox10 = ""
ComboBox11 = ""
ComboBox5 = "Offset"
Else
ComboBox9 = ""
ComboBox10 = ""
End If
End If
Sheets("Order").Calculate
Me.ComboBox4.RowSource = Workbooks("Userform.xlsm").Sheets("Order").Range("D5").Value
Me.ComboBox5.RowSource = Workbooks("Userform.xlsm").Sheets("Order").Range("D7").Value
TextBox3 = Workbooks("Userform.xlsm").Sheets("Order").Range("b14").Value
End With
End Sub
I've tried with this
Code:
Private Sub ComboBox1_Change()
[B]Workbooks("Userform.xlsm").Activate[/B]
[B]Worksheets("Order").Select[/B]
Workbooks("Userform.xlsm").Sheets("Order").Range("b2") = ComboBox1.Value
Workbooks("Userform.xlsm").Sheets("Order").Calculate
On Error GoTo row3
Me.ComboBox3.RowSource = Workbooks("Userform.xlsm").Sheets("Order").Range("D4").Value
row3:
On Error GoTo row4
Me.ComboBox4.RowSource = Workbooks("Userform.xlsm").Sheets("Order").Range("D5").Value
row4:
TextBox3 = Workbooks("Userform.xlsm").Sheets("Order").Range("b14").Value
End Sub
The error I mostly get is out of the range when it tries to deal with a cell in any way.
All of that works fine if workbook stays active in the background or if it is the only open workbook in the application
As soon as other workbook is activated, userform breaks as it can't get the source for it's objects
Any way to avoid and bypass this?
Thank you