ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   ComboBox value? (https://www.excelbanter.com/excel-discussion-misc-queries/178133-combobox-value.html)

dksaluki

ComboBox value?
 
I'm writing code in a module, and I want to get the value of a certain
ComboBox that I've added to Sheet1 tab. Is that possible, or can I
only reference the combobox while writing code IN THE PRIVATE SUB for
that control? ....as in:

Private Sub ComboBox1_Change()

//somewhere in here only

End Sub

If i'm outside the sub, how do i reference it? is it something like,
Sheet(1).Shapes(".....")....something something....?

I'd appreciate any help.

dck

FSt1

ComboBox value?
 
hi.
the default value of the combo box is the value property..meaning that
whatever the user selects is the value of the combo box..ie...
Private Sub ComboBox1_Change()
if combobox1.value = "something" then
xlrun_some_code
else
xldo_something_else
end if

another concept....
dim something as stirng
combobox1.value = something
msgbox something

.....meaning you can declare the value of the combobox1 within the sub_change
event and in more than one way.
be creatiive.

regards
FSt1

"dksaluki" wrote:

I'm writing code in a module, and I want to get the value of a certain
ComboBox that I've added to Sheet1 tab. Is that possible, or can I
only reference the combobox while writing code IN THE PRIVATE SUB for
that control? ....as in:

Private Sub ComboBox1_Change()

//somewhere in here only

End Sub

If i'm outside the sub, how do i reference it? is it something like,
Sheet(1).Shapes(".....")....something something....?

I'd appreciate any help.

dck



All times are GMT +1. The time now is 08:27 PM.

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