The best way to start learning VBA is to record a macro doing what you want to
do, then look at the macro and understand what it is doing.
Then you try changing something and run the macro to see what it does.
Do this and then see if the macro achieves what you want. Come back to the
list with specific problems if it does not.