I have a spreadsheet which stores client details in a typical columns/rows fashion, i.e. Col A = client ID, Col B = client name, Col C = client type
The worksheet with this data on is accessed by various VBA modules, however the current way of referring to a specific field is somewhat inefficient. The code modules process the client at the top of the list (always row 2), then delete this row and process the next client etc. This part is okay but there is a code module that looks at the Client Type (Col C) field, which is always cell C2. In order to refer to this cell the code currently starts:
What I really want to be able to do is read in all the data for the client in row 2 into an object, or perhaps a custom data type? I want the VBA code to read more like:
I did think that creating an object might be the way to do it, however my experience of creating objects is fairly limited. I know you can create properties using the Let/Get keywords, but I am unsure how I would 'read in' the data for the next Client. I think I would want a method along the lines of:
ClientObject.GetNextClient
Which then reads in the data for client ID, client name, client type etc. However I want to be able to read these properties back using ClientObject.ClientID, ClientObject.ClientName etc
Is this possible? I guess I'm asking how do I pass values to multiple object properties in one go? Is it possible to do this by running a single procedure which then passes values to a range of properties?
Thanks in advance
-Rob
Bookmarks