ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combobox (https://www.excelbanter.com/excel-programming/279683-combobox.html)

scrabtree[_2_]

combobox
 
It is a combobox from the controls toolbar. Below is the
change event code I have wrote. The program keeps
stopping, thought, and highlighting: "cmbcc.RowSource =
Sheets("Coding").Range("B4:B12")"




Private Sub cmbmajorarea_Change()
If cmbmajorarea.Value = "Environmental" Then
cmbcc.RowSource = Sheets("Coding").Range("B4:B12")
Else
cmbcc.Value = "2"
End If
End Sub

steve

combobox
 
Rowsource needs to be text.

so try:
cmbcc.RowSource = Sheets("Coding").Range("B4:B12").Address

or
cmbcc.RowSource = "Coding!" & Sheets("Coding").Range("B4:B12").Address

make sure it is all on one line...
--
sb
"scrabtree" wrote in message
...
It is a combobox from the controls toolbar. Below is the
change event code I have wrote. The program keeps
stopping, thought, and highlighting: "cmbcc.RowSource =
Sheets("Coding").Range("B4:B12")"




Private Sub cmbmajorarea_Change()
If cmbmajorarea.Value = "Environmental" Then
cmbcc.RowSource = Sheets("Coding").Range("B4:B12")
Else
cmbcc.Value = "2"
End If
End Sub




Tom Ogilvy

combobox
 
Better would be:

cmbcc.RowSource =
Sheets("Coding").Range("B4:B12").Address(external: =True)

--
Regards,
Tom Ogilvy

steve wrote in message
...
Rowsource needs to be text.

so try:
cmbcc.RowSource = Sheets("Coding").Range("B4:B12").Address

or
cmbcc.RowSource = "Coding!" & Sheets("Coding").Range("B4:B12").Address

make sure it is all on one line...
--
sb
"scrabtree" wrote in message
...
It is a combobox from the controls toolbar. Below is the
change event code I have wrote. The program keeps
stopping, thought, and highlighting: "cmbcc.RowSource =
Sheets("Coding").Range("B4:B12")"




Private Sub cmbmajorarea_Change()
If cmbmajorarea.Value = "Environmental" Then
cmbcc.RowSource = Sheets("Coding").Range("B4:B12")
Else
cmbcc.Value = "2"
End If
End Sub






steve

combobox
 
Tom,

Thanks for the input but I am not familiar with using 'extermal' reference.

The help file on this is skimpy, could you explain this to me?

Thanks...

--
sb
"Tom Ogilvy" wrote in message
...
Better would be:

cmbcc.RowSource =
Sheets("Coding").Range("B4:B12").Address(external: =True)

--
Regards,
Tom Ogilvy

steve wrote in message
...
Rowsource needs to be text.

so try:
cmbcc.RowSource = Sheets("Coding").Range("B4:B12").Address

or
cmbcc.RowSource = "Coding!" & Sheets("Coding").Range("B4:B12").Address

make sure it is all on one line...
--
sb
"scrabtree" wrote in message
...
It is a combobox from the controls toolbar. Below is the
change event code I have wrote. The program keeps
stopping, thought, and highlighting: "cmbcc.RowSource =
Sheets("Coding").Range("B4:B12")"




Private Sub cmbmajorarea_Change()
If cmbmajorarea.Value = "Environmental" Then
cmbcc.RowSource = Sheets("Coding").Range("B4:B12")
Else
cmbcc.Value = "2"
End If
End Sub








Tom Ogilvy

combobox
 
? Range("A1").Address(External:=True)
[Book1]Sheet1!$A$1

Really doesn't require much explanation.

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
Tom,

Thanks for the input but I am not familiar with using 'extermal'

reference.

The help file on this is skimpy, could you explain this to me?

Thanks...

--
sb
"Tom Ogilvy" wrote in message
...
Better would be:

cmbcc.RowSource =
Sheets("Coding").Range("B4:B12").Address(external: =True)

--
Regards,
Tom Ogilvy

steve wrote in message
...
Rowsource needs to be text.

so try:
cmbcc.RowSource = Sheets("Coding").Range("B4:B12").Address

or
cmbcc.RowSource = "Coding!" & Sheets("Coding").Range("B4:B12").Address

make sure it is all on one line...
--
sb
"scrabtree" wrote in message
...
It is a combobox from the controls toolbar. Below is the
change event code I have wrote. The program keeps
stopping, thought, and highlighting: "cmbcc.RowSource =
Sheets("Coding").Range("B4:B12")"




Private Sub cmbmajorarea_Change()
If cmbmajorarea.Value = "Environmental" Then
cmbcc.RowSource = Sheets("Coding").Range("B4:B12")
Else
cmbcc.Value = "2"
End If
End Sub










All times are GMT +1. The time now is 01:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com