I hope you can help!

I have a long list of data, with a range of department codes associated to the data. My workbook has a sheet containing the mass of data, and several other sheets containing differing groups of department codes. These groups of department codes are given/defined a name to make referencing them easier. Thus, I can quickly and easily advanced filter my main list of data, specify the different names under the criteria, and amend all the associated data linked to that department code in one go.

After I select each group through advanced filter, I put a letter into the column B for each of the rows - the letter varies according to the group chosen. Doing this manually basically means putting the letter into the top of the newly filtered rows, and copy/pasting it to the rows below.

However, I've tried to get a macro do to the same, to remove the last job. My macro can filter the data using the names fine, but it can't put the letter into all of the filtered rows. The problem is, I want it to start from the top of the filtered list, put in a letter, and then copy it to all of the filtered rows. However, Excel, as far as I can see, has no way of saying "the first of the filtered cells" - it always wants some kind of direct reference. It won't always be the same, as the top could be B2 for the first criteria, but then it won't be for the second, third, fourth etc...

Is there any way around this? If you're able to help then I'd really appreciate it!