Collection Item Attribute Change

Marco912

New Member
Joined
Dec 11, 2018
Messages
1
Hi,

as I am new on this Forum, I don't know if my question has already been posted.
If yes, please just show me which post.

I have a collection with n classes (Batch) and I like to change attributes of the items.
These attributes are strings like (Name, Adress, Phone, etc...)
A create a GUI with textboxes where new values can be entered.
Now I like to update the related attribute in the collection items.

ex:
Code:
     Public collBatches As New Collection  ' in UserForm1
     Dim BatchData As New Batch
     Set BatchData = New Batch
.....
     collBatches.Add BatchData     ' add batches to collection ....
.....
     Dim sCollVarName As String
     Dim objCollItem As Object
....
     sCollVarName = "Name"
....
     sControlName = "UserForm1.collBatches(" & iBatch & ")." & sCollVarName
     Set objCollItem = sControlName      ' ????????? how is the syntax 
     objCollItem.Value = tbxTextBox.Value    ' like to pass the value entered in the textbox
....

Kind regards
Marco
 
Last edited by a moderator:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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
Back
Top