#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Listboxes

I am pulling my hair out on this one (what little is left).

Have a listbox LBclerk1
When I set the value by code

Worksheets("daily").LBClerk1.Value = .Range("s" & rc).Value

The listbox itself does not update with the new value. As near as I can tell
that is because the boundvalue does not update to.
I have tried to set the bound value and the listindex but to no avail.
If I choose another worksheet and then chose the worksheet with the listbox
it will now show the correct value. Doing so in code with
worksheets("x").select does not work. What am I missing? Or, is there a
site that explains using listboxes and how to code for this?

Thanks Carl


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Listboxes

There is a lot of information at this site. It also provides sample code.

http://support.microsoft.com/kb/126794

"C Brehm" wrote:

I am pulling my hair out on this one (what little is left).

Have a listbox LBclerk1
When I set the value by code

Worksheets("daily").LBClerk1.Value = .Range("s" & rc).Value

The listbox itself does not update with the new value. As near as I can tell
that is because the boundvalue does not update to.
I have tried to set the bound value and the listindex but to no avail.
If I choose another worksheet and then chose the worksheet with the listbox
it will now show the correct value. Doing so in code with
worksheets("x").select does not work. What am I missing? Or, is there a
site that explains using listboxes and how to code for this?

Thanks Carl



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Listboxes

Thanks, but nothing there has helped. I looked through over 40 articles in
the knowledge base.
What really gets me is

Worksheets("daily").LBClerk1.Listindex

in the immediate widow works.
Does exactly what I want. But in code it returns an error.

PS.I only use .range is only used inside a with statement.

"JLGWhiz" wrote in message
...
There is a lot of information at this site. It also provides sample code.

http://support.microsoft.com/kb/126794

"C Brehm" wrote:

I am pulling my hair out on this one (what little is left).

Have a listbox LBclerk1
When I set the value by code

Worksheets("daily").LBClerk1.Value = .Range("s" & rc).Value

The listbox itself does not update with the new value. As near as I can
tell
that is because the boundvalue does not update to.
I have tried to set the bound value and the listindex but to no avail.
If I choose another worksheet and then chose the worksheet with the
listbox
it will now show the correct value. Doing so in code with
worksheets("x").select does not work. What am I missing? Or, is there a
site that explains using listboxes and how to code for this?

Thanks Carl





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Listboxes

The three most common methods of returning a listbox value to a range in VBA
a

myRange = ListBox1.Value (For single select lists)
myRange = ListBox1.ListIndex(i) (When BoundColumn is at 0)
myRange = ListBox1.Selected(i) (For Multiselection lists)

I have not seen any other methods used, but that does not mean they are not
out there.


"C Brehm" wrote:

Thanks, but nothing there has helped. I looked through over 40 articles in
the knowledge base.
What really gets me is

Worksheets("daily").LBClerk1.Listindex

in the immediate widow works.
Does exactly what I want. But in code it returns an error.

PS.I only use .range is only used inside a with statement.

"JLGWhiz" wrote in message
...
There is a lot of information at this site. It also provides sample code.

http://support.microsoft.com/kb/126794

"C Brehm" wrote:

I am pulling my hair out on this one (what little is left).

Have a listbox LBclerk1
When I set the value by code

Worksheets("daily").LBClerk1.Value = .Range("s" & rc).Value

The listbox itself does not update with the new value. As near as I can
tell
that is because the boundvalue does not update to.
I have tried to set the bound value and the listindex but to no avail.
If I choose another worksheet and then chose the worksheet with the
listbox
it will now show the correct value. Doing so in code with
worksheets("x").select does not work. What am I missing? Or, is there a
site that explains using listboxes and how to code for this?

Thanks Carl






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Listboxes

P.S. When you are not using code inside a With statement, do not use the
period in front of Range, [.Range]. It can confuse the compiler. You would
only use the .Range syntax if you are using something like With Worksheet(2).
Then the
[.] before the Range tells VBA that the Range belongs to Worksheet(2) and
not the ActiveSheet.

"C Brehm" wrote:

I am pulling my hair out on this one (what little is left).

Have a listbox LBclerk1
When I set the value by code

Worksheets("daily").LBClerk1.Value = .Range("s" & rc).Value

The listbox itself does not update with the new value. As near as I can tell
that is because the boundvalue does not update to.
I have tried to set the bound value and the listindex but to no avail.
If I choose another worksheet and then chose the worksheet with the listbox
it will now show the correct value. Doing so in code with
worksheets("x").select does not work. What am I missing? Or, is there a
site that explains using listboxes and how to code for this?

Thanks Carl





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
Need help with Listboxes! Angelus[_2_] Excel Programming 4 January 24th 06 04:50 AM
listboxes [email protected] Excel Programming 2 March 30th 05 06:41 PM
listboxes [email protected] Excel Programming 3 February 22nd 05 04:01 PM
listboxes Mandy[_2_] Excel Programming 3 May 7th 04 04:38 PM
Listboxes Lionel Fridjhon Excel Programming 0 April 5th 04 06:28 PM


All times are GMT +1. The time now is 01:24 AM.

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"