Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Problem in Variable Scope

I have a Combobox (cbovar) inside the Worksheet "Sheet1" I also have a
Submit button that calls a macro "Macro A" (Note: There are no Userforms
here. The buttons are in the worksheet "sheet1".)

The function of "Macro A" is to show the value of the combobox.

sub macroa
msgbox(cbovar)
end sub


The value shows up blank even when the combobox is checked on "Sheet1".

How do I get the value of the combobox printed on the screen? I am having
problem understanding "variable scope" ...Can anyone help me out here please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Problem in Variable Scope

Try:

MsgBox Sheet1.cbovar

And use "Option Explicit"!

--

Vasant



"vrk1" wrote in message
...
I have a Combobox (cbovar) inside the Worksheet "Sheet1" I also have a
Submit button that calls a macro "Macro A" (Note: There are no Userforms
here. The buttons are in the worksheet "sheet1".)

The function of "Macro A" is to show the value of the combobox.

sub macroa
msgbox(cbovar)
end sub


The value shows up blank even when the combobox is checked on "Sheet1".

How do I get the value of the combobox printed on the screen? I am

having
problem understanding "variable scope" ...Can anyone help me out here

please?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Problem in Variable Scope

That did not work. I am getting a Run Time Error message.

Maybe I am doing something wrong. Can you explain with a code please?

Thanks

"Vasant Nanavati" wrote:

Try:

MsgBox Sheet1.cbovar

And use "Option Explicit"!

--

Vasant



"vrk1" wrote in message
...
I have a Combobox (cbovar) inside the Worksheet "Sheet1" I also have a
Submit button that calls a macro "Macro A" (Note: There are no Userforms
here. The buttons are in the worksheet "sheet1".)

The function of "Macro A" is to show the value of the combobox.

sub macroa
msgbox(cbovar)
end sub


The value shows up blank even when the combobox is checked on "Sheet1".

How do I get the value of the combobox printed on the screen? I am

having
problem understanding "variable scope" ...Can anyone help me out here

please?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Problem in Variable Scope

Is cbovar a ComboBox from the Forms Toolbar or the Control Toolbox? If the
former, you cannot directly retrieve its value; you have to look it up from
the source range.

--

Vasant

"vrk1" wrote in message
...
That did not work. I am getting a Run Time Error message.

Maybe I am doing something wrong. Can you explain with a code please?

Thanks

"Vasant Nanavati" wrote:

Try:

MsgBox Sheet1.cbovar

And use "Option Explicit"!

--

Vasant



"vrk1" wrote in message
...
I have a Combobox (cbovar) inside the Worksheet "Sheet1" I also have

a
Submit button that calls a macro "Macro A" (Note: There are no

Userforms
here. The buttons are in the worksheet "sheet1".)

The function of "Macro A" is to show the value of the combobox.

sub macroa
msgbox(cbovar)
end sub


The value shows up blank even when the combobox is checked on

"Sheet1".

How do I get the value of the combobox printed on the screen? I am

having
problem understanding "variable scope" ...Can anyone help me out here

please?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
variable scope mgasparel Excel Programming 2 February 16th 05 05:22 PM
scope/ lifetime of variable jeffP Excel Programming 5 September 19th 04 05:25 AM
Variable Scope Kevin Excel Programming 1 September 14th 04 07:05 PM
Variable scope TonyM Excel Programming 5 April 24th 04 01:02 PM
Scope of Public Variable Dkline[_2_] Excel Programming 9 October 22nd 03 04:53 PM


All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"