Here is a routine that shows how to use Solver within VBA.

Note: These bits of code are mostly for my own reference, but if anyone else finds them useful all the better.