Saturday, October 12, 2013

How to Use Visual Basic to Add a Worksheet in Excel 2007


1. Click the Windows 'Start' button and select 'All Programs.' Click 'Microsoft Office,' then click 'Microsoft Excel.' The programming software opens.
2. Click the 'Office' button and click 'Open.' Click your Excel file name to open it in your software. Click the 'Development' tab and 'View Code' to open the VBA coding file for the spreadsheet.
3. Type the following code in your VBA code file:Set newSheet = Worksheet.AddnewSheet.Name = 'New Sheet'newSheet.ActivateThis code creates a new sheet and names it 'New Sheet.' The code then makes it the active sheet.
4. Click the 'Save' button and close the VBA code file. Close the file and reopen it to see a new sheet created in the file.

Blogger news