View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default Code runs in wrong workbook?

I assume this is to replace my ComboBox2.RowSource = "Lookup!T3:T4" line,
but what does this mean?
ThisWorkbook I can understand. Me.ComboBox2 has me puzzled. External=True
I'm not sure about, but shouldn't this be false, as the address is in the
same workbook and also in the sheet previously referred to?

--
Ian
--
"Norman Jones" wrote in message
...
Hi Ian,

Try qualifying the RowSource assignments, e.g.:

Me.ComboBox2.RowSource = ThisWorkbook.Sheets("Lookup"). _
Range("T3:T4").Address(External:=True)


---
Regards,
Norman



"Ian" wrote in message
...
As I said in my OP, I'm not sure what's relevant, but here's some for
starters.

Private Sub ComboBox1_change()
Select Case ComboBox1
Case "OP100"
ComboBox2.Enabled = True
ComboBox2.Text = "Select"
ComboBox2.RowSource = "Lookup!T3:T4"
ComboBox3.Text = "No"
ComboBox3.Enabled = False
Case "OC100"
ComboBox2.Enabled = True
ComboBox2.Text = "Select"
ComboBox2.RowSource = "Lookup!T3:T4"
ComboBox3.Text = "Yes"
ComboBox3.Enabled = False
Case "OP100OT"
ComboBox2.Enabled = True

This carries on in a similar vein with various other Cases, not always
looking to the same RowSource range. Unfortunately, the Lookup sheet is
stored in a template which then becomes fielname1 on creation of a file
and is saved as another filename which will be unique, so I can't specify
Lookup with a filename. The code in question is on the userform and is
not required once the data has been entered and the worksheet configured.
I don't suppose there's any way to delete a form, rather than hiding it?

--
Ian
--
"Norman Jones" wrote in message
...
Hi Ian,

Try Posting the relevant code.


---
Regards,
Norman



"Ian" wrote in message
...
I'm having trouble getting my head round a problem I'm having with some
code.

I have created a userform in a workbook (let's call this workbook1)
which requires users to enter data which is then used to configure a
worksheet. There are 2 worksheets, the one called Lookup is hidden and
the forms refers to this one to find data for comboboxes. The userform
then configures the Machine worksheet and the userform is hidden.

My problem arises (sometimes) when I have workbook1 open, but I am
working on another workbook (say workbook2). I can't remember the exact
error I get, but when I debug, it takes me to one of the lines in the
workbook1 form's code referring to the range in Lookup for a combobox.

I'm guessing the reason I'm getting an error is because workbook2 does
not have a sheet called Lookup.

Can anyone offer a reason for this happeneing? Is there a way to render
the code in the userform inoperative when the form is hidden?

Workbook1 is actually saved as a template so, once the form has
finished taking data and has been hidden, there will never be a use for
it again. Can the entire form be deleted in code?

I could post some of the code, but I'm not sure which bits are
relevant.

--
Ian
--