Hey!
I'm quite new to VBA and would really appreciate some help to solve a problem I ran into. I have a dataset that looks like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]NAME[/TD]
[TD]SCHOOL[/TD]
[TD]SCORE[/TD]
[/TR]
[TR]
[TD]Lisa[/TD]
[TD]Johnny School[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]Inga[/TD]
[TD]Jimmy School[/TD]
[TD]35[/TD]
[/TR]
[TR]
[TD]Johnny[/TD]
[TD]Carrie School[/TD]
[TD]28[/TD]
[/TR]
[TR]
[TD]Beth[/TD]
[TD]Carrie School[/TD]
[TD]32[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Johnny School[/TD]
[TD]35[/TD]
[/TR]
[TR]
[TD]Sarah[/TD]
[TD]Jimmy School[/TD]
[TD]40[/TD]
[/TR]
</tbody>[/TABLE]
This is just a small sample of my data. There are like 500 different schools in there and I would like to loop through all unique values in the school column. I'll then use it to create a pdf with scores for each school. I'll look into that procedure at a later stage, but for now I need to know how to set up a proper loop.
I've looked at various examples and I understand that I need to declare an array and then use a "for each" loop.
But I don't really understand how to declare an array from the unique values in a column. I don't want to write all the school names down. Can someone help me out?
Thanks in advance!
Johan
I'm quite new to VBA and would really appreciate some help to solve a problem I ran into. I have a dataset that looks like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]NAME[/TD]
[TD]SCHOOL[/TD]
[TD]SCORE[/TD]
[/TR]
[TR]
[TD]Lisa[/TD]
[TD]Johnny School[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]Inga[/TD]
[TD]Jimmy School[/TD]
[TD]35[/TD]
[/TR]
[TR]
[TD]Johnny[/TD]
[TD]Carrie School[/TD]
[TD]28[/TD]
[/TR]
[TR]
[TD]Beth[/TD]
[TD]Carrie School[/TD]
[TD]32[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Johnny School[/TD]
[TD]35[/TD]
[/TR]
[TR]
[TD]Sarah[/TD]
[TD]Jimmy School[/TD]
[TD]40[/TD]
[/TR]
</tbody>[/TABLE]
This is just a small sample of my data. There are like 500 different schools in there and I would like to loop through all unique values in the school column. I'll then use it to create a pdf with scores for each school. I'll look into that procedure at a later stage, but for now I need to know how to set up a proper loop.
I've looked at various examples and I understand that I need to declare an array and then use a "for each" loop.
But I don't really understand how to declare an array from the unique values in a column. I don't want to write all the school names down. Can someone help me out?
Thanks in advance!
Johan