I have some previously made code that I need to use and Im a little rusty on my Visual basic for applications.
There is a list in a form that is generated from a spreadsheet.
The items in the list are generated in the following format, "lawyer's name - charges he defends":
example:
Johnson - Reckless Driving
Johnson - Speeding
Williams - DUI
Williams - Reckless
Each line is a separate string and each string is attached to an integer in an accompanying spreadsheet.
So when you select
"Johnson - Reckless Driving" it returns a value equal to the number of Reckless Driving cases for Johnson.
You can select as many items from the list as you like and it will return the total of all selected items.
There are often 20 - 30 Names with up to 3 different charges following their names to choose.
All I need to do is create a function that groups all strings with the same name in a single value when multiple lawyers are selected.
If the above 4 names were selected the desired outcome would be to output the following:
Johnson - Reckless Driving - 10
Johnson - Speeding - 5
Williams - DUI - 3
Williams - Reckless - 2
Johnson Total: 15
Williams Total: 5
Grand total: 20
Basically, what I need is a function that will read each item in the list up to the hyphen then group items based on what it finds.
This seems pretty simple, but I'm rusty and don't really know where to begin. I will appreciate any insight or solutions.
There is a list in a form that is generated from a spreadsheet.
The items in the list are generated in the following format, "lawyer's name - charges he defends":
example:
Johnson - Reckless Driving
Johnson - Speeding
Williams - DUI
Williams - Reckless
Each line is a separate string and each string is attached to an integer in an accompanying spreadsheet.
So when you select
"Johnson - Reckless Driving" it returns a value equal to the number of Reckless Driving cases for Johnson.
You can select as many items from the list as you like and it will return the total of all selected items.
There are often 20 - 30 Names with up to 3 different charges following their names to choose.
All I need to do is create a function that groups all strings with the same name in a single value when multiple lawyers are selected.
If the above 4 names were selected the desired outcome would be to output the following:
Johnson - Reckless Driving - 10
Johnson - Speeding - 5
Williams - DUI - 3
Williams - Reckless - 2
Johnson Total: 15
Williams Total: 5
Grand total: 20
Basically, what I need is a function that will read each item in the list up to the hyphen then group items based on what it finds.
This seems pretty simple, but I'm rusty and don't really know where to begin. I will appreciate any insight or solutions.