For a start, you might use the macro recorder to record yourself doing it manually. On the VisualBasic toolbar, a large dot starts the macro recorder. Then you do what it is you want to do. Then you click the square to stop the recorder. Then, Alt + F11 to open the Visual Basic Editor. Find a tree diagram called Projects (if it's not visible Ctrl + R will bring it up). Find your workbook in the Project tree (every workbook is called a Project in the Project Window). Click the + to open up your project tree, find Module1 and double click it. Your code should appear in the big code window.
Study the code. Then ask further questions.
I hope that's a good start.
jg