Work Smart with Excel Macros

Microsoft Excel Macro tips: This book describe how you can use Excel to repeated works, such as report and other office documents.
• • •

Copy table Format Rename sheet as MonthName Rename sheet as Week Day Name

Microsoft Excel was one of the largest using Office application available to day. The feature Macro in Microsoft Office Office help us to cop with repeated tasks like creating reports and other basic operation. Using Macro we can record any actions and commands.Here we illustrate few of the common tasks.

Copy table Format
1. Create the table format you want.(With suitable Headings,Rows,Boarders and other features). 2. Rename the Sheet as Sample Sheet/any desired name.* Do not change the name after the recording. 3. In this step into Second Work sheet and Rename it as sheet by using the Rename Command. 4. Now Go to Tools ->Macro->Record New Macro enter 'NewReport" as Macro Name. 5. Select the table that are created in the Sample Sheet and copy. 6. Paste it to the worksheet named sheet, use paste option to keep exact column width as in the Sample Sheet. 7. Stop the Macro Recorder

Now you will get the Macro code. To see the Visual Basic Code press Alt + F8 (Use Tools->Macro-Macros) and select the Macro NewReport and Click the Edit Button, now you can see you code. Add the following code in the beginning of the Macro(Visual Basic Editor) ActiveWorkbook.Sheets.Add ActiveWorkbook.ActiveSheet.Name = "Sheet" *The above code is used to add a new sheet and Rename the sheet as "Sheet"

Rename sheet as MonthName
Add the following code to end of the Macro. On Error GoTo Error: ActiveWorkbook.ActiveSheet.Name = MonthName(Month(Date) - 1) Error: MsgBox "Sheet name already Exist" In the same manner you can put sheet name as Week Day Name too

Rename sheet as Week Day Name

Add the following code to end of the Macro. On Error GoTo Error: ActiveWorkbook.ActiveSheet.Name = WeekdayName(Weekday(Date)) Error: MsgBox "Sheet name already Exist" For the proper working of these Macros,it is wise that check that the sheet name already exist or not otherwise it will be Over Write. You can arrange these macros into separate menus and tool bars to add additional features to your office application, which let you work in a smart way.

Sign up to vote on this title
UsefulNot useful