ListBox-insert text from cell

The Dutchman

Board Regular
Joined
Apr 10, 2008
Messages
72
I am working on a userform where a client's profile can be edited. A client's name is selected and then a number of textboxes and listboxes are automatically populated from the information from that client last record on file.

There are 3 listboxes in the userform that are populated from 3 different cell ranges when the userform is activated.

When I attempted to populate the listbox (which was populated already at activation) with the text/value from a clients record I get the following message:

"Could not set the text property. Invalid propert value."

Just an FYI... the value/text from the cell I'm pulling data and pushing to the various ListBoxes corresponds with data that are in the listboxes when they are populated when the userform is activated.

The code I used is as follows:
Rich (BB code):
Rich (BB code):
Me.ListBox1.Text = Range(caddress).Offset(0, 23).Value
Me.ListBox2.Text = Range(caddress).Offset(0, 13).Value
Me.ListBox3.Text = Range(caddress).Offset(0, 14).Value
 
'*** AS WELL I TRIED ****
 
Me.ListBox1.Value = Range(caddress).Offset(0, 23).Value
Me.ListBox2.Value = Range(caddress).Offset(0, 13).Value
Me.ListBox3.Value = Range(caddress).Offset(0, 14).Value

Any ideas out there?

 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

doofusboy

Well-known Member
Joined
Oct 14, 2003
Messages
1,325
Have you tried:

Rich (BB code):
Me.ListBox1.Add = Range(caddress).Offset(0, 23).Value
Me.ListBox2.Add = Range(caddress).Offset(0, 13).Value
Me.ListBox3.Add = Range(caddress).Offset(0, 14).Value
 

The Dutchman

Board Regular
Joined
Apr 10, 2008
Messages
72
Thanks for taking the time to respomd to my query.

I just tried your suggestion and it came up with a the following message:

"Method or data Memeber not Found"

Looking at the ".Add" would that potentially add items to the lisbox? All I want to do is have the listbox show the item that was choosen the last time that record was either created or when it was last edited.

Any other ideas?

Ray
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows
Ray

This is from Help.
VBA Help said:
For a ListBox, the value of Text must match an existing list entry. Specifying a value that does not match an existing list entry causes an error.
And there is no Add method/property/whatever for listboxes.

I've read your original post a number of times but I still don't understand what you are actually trying to do, probably me though.:eek:

First you say you've populated 3 listboxes with data from a range of cells, so supposedly they would have multiple entries.

Then you seem to be saying you want to populate the listboxes with an individual entry.:confused:
 

The Dutchman

Board Regular
Joined
Apr 10, 2008
Messages
72
Thanks for you curiosity Norie:

Here is what I am trying to accomplish.

A client profile is first created. When this "Create Client Profile" userbox1 is activate items for 3 listboxes are added. When complete, the profile is saved (let's say to row 10).

Now when you want to edit that same profile, you go into userform2 "Edit a Client Profile". When activated items are added to 4 listboxes (the extra one being the client list which was not in the previous userform).

When in the Edit Client Profile" userform, the first thing you do is choose a client from a lisbox. When this listbox is updated data from row 10 is then placed in the respective textboxes as well, I'm trying to populate the listboxes from the correrponding data that was originally saved in row 10.

If the person so choose the change the items listed in the 3 listboxes for that company he/she can do so... but when the record is first brought up the previous choice is shown.

I hope this helps you understand what I'm trying to accomplish and find a solution.

Ray
 

Watch MrExcel Video

Forum statistics

Threads
1,122,959
Messages
5,599,056
Members
414,281
Latest member
Engjamal2021

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top