Being new to VBA I would recommend you first port of call to be utilising the record macro functionality, known as the Excel Primer. If you go to [Tools]-[Macro]-[Record New Macro] a dialogue box appears asking where you want to record the macro, usually you would set this to "This Workbook" and click continue/OK.
Conduct the processes you want to achieve such as adjusting the column widths as you described, then click on the stop icon represented by the filled square. This stops recording the macro you have just created.
Then go to [Tools]-[Macro]-[Macros] and in the form that appears select the name of the macro you have just created and click edit. You will then be shown the environment called the Visual Basic Editor or VBE. The code displayed in the VBE is what you just recorded. Make yourself accustomed to the different areas and what they are showing you. Look at the code, if necessary step through one process at a time in the code by first placing the cursor within the text of the macro and by pressing the function key [F8] execute on line at a time, if you split your windows into two half screen with both excel and VBE visable you can see the results of the code as it is executed. I found this is the best way to learn the basics.
I now swear by the wrox "Excel 2000 VBA - programmers reference" book. I don't work for them, but I think it is excellent value for money.
If you are having trouble with specific code once you have recorded it and amended it, then post the code with your problem on forums such as this.
Regards
Matthew
|