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

Hi,

I want to creat a combo box that remembers what value is selected
when it was used the last time.

For example I want to create a comb box where you can select column A
thru Z. If the uses selects column B the first time he used the
application I want this combo box to show this value when next time
the application is started again.

Is there a type of variable I can use for this or I have to save the
value somewhere and just read it from there the next time.

Please let me know if there is a better way of doing this.

Thanks
Sonu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Variable value

The value can only be stored within a worksheet under this situation as
variables within VBA are only declared and instantiated when they are
brought into scope and adjusted as needed (Except for constants as constant
variables by it's very nature can't be changed). The only exception to that
rule, but would not work in this case are veriables known as Constants. The
reason why a Constant variable isn't going to work, the value the constant
variable hold is hard coded within VBA at declaration time. All other
variables are instantiated to a default value at the time they are declared
and brought into scope. For this sort of reason, you setup your variables
as:

Declare type of variable (what data type) at the appropriate level (Global,
Module, or Method level).
A method is either a subprocedure (Sub) or function (Function).
Set/Let the variable be of a certain Object/Value respectively (Done within
a method in most cases, but can also be done within the signiture portion of
a method, which a signature is the declaration of variable(s) in between the
paranthesises after the method name).

I'm not sure how much you know of programming, but you can use range names
in the event that you think insertion/deletion of rows/columns/cells may
take place as VBA doesn't adjust range references to easily, which I been
able to account for this only via the usage of range names.

Sincerely,

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"sonu" wrote in message
...
Hi,

I want to creat a combo box that remembers what value is selected
when it was used the last time.

For example I want to create a comb box where you can select column A
thru Z. If the uses selects column B the first time he used the
application I want this combo box to show this value when next time
the application is started again.

Is there a type of variable I can use for this or I have to save the
value somewhere and just read it from there the next time.

Please let me know if there is a better way of doing this.

Thanks
Sonu



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Variable value

On Feb 8, 12:48 pm, sonu wrote:
Hi,

I want to creat a combo box that remembers what value is selected
when it was used the last time.

For example I want to create a comb box where you can select column A
thru Z. If the uses selects column B the first time he used the
application I want this combo box to show this value when next time
the application is started again.

Is there a type of variable I can use for this or I have to save the
value somewhere and just read it from there the next time.

Please let me know if there is a better way of doing this.

Thanks
Sonu


Hi Sonu,

Store the selected value on a sheet and read the value into memory the
next time the workbook is opened

Regards
-goss
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Variable value

Is this a combobox from the control toolbox that's been placed on a worksheet?

If yes, how about using a linkedcell (on a hidden worksheet???).

If the workbook is saved after the choice, it should be remembered the next time
the workbook opens.

sonu wrote:

Hi,

I want to creat a combo box that remembers what value is selected
when it was used the last time.

For example I want to create a comb box where you can select column A
thru Z. If the uses selects column B the first time he used the
application I want this combo box to show this value when next time
the application is started again.

Is there a type of variable I can use for this or I have to save the
value somewhere and just read it from there the next time.

Please let me know if there is a better way of doing this.

Thanks
Sonu


--

Dave Peterson
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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Getting inconsistent Error 91-Object variable or With block variable not set mfq Excel Programming 0 December 14th 05 06:08 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 12:25 PM.

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

About Us

"It's about Microsoft Excel"