I keep getting an error when I try to put this in a Sub. It's an "Object reference not set to an instance of an object" error.
I know I'm missing something obvious, but I have no idea what.
Care to give a noob a boost?
UPDATE: I figured it out. Using the following code, I was able to get rid of the error: