Create a Table of Contents In Excel Using VBA

The following macro not only creates a table of contents at the beginning of the workbook, but it also adds hyperlinks so that you can easily click a hyperlink to jump to a sheet. Create a Table of Contents for your workbook Sub CreateTableOfContents() ‘Step 1: Declare Variables Dim i…

Protect or Unprotect All Worksheets At Once

If you want to protect or unprotect all worksheets in Excel, you only can do each worksheet manually. Is there any way to have a Macro protect or unprotect multiple worksheets at once in Excel quickly and easily? Protect All Worksheets At Once Protect All Worksheets Use InputBox Sub ProtectAllWorksheetsWithInputbox()…

Print Worksheets VBA

In Excel, when you click the Print button, Excel will not print hidden sheets, except use VBA. Here is a large examples of print Worksheets use Excel VBA, Before you read this tutorial, you may need to know the difference between Worksheets and Sheets. PrintOut Syntax expression.PrintOut(From, To, Copies, Preview,…

Create a New Workbook for Each Sheet

Sometimes you may need to create a new workbook for each sheet, it seems very boring to do it manually, in this situations, you can use the following macro. Create a New Workbook for Each Sheet VBA Code Sub SheetsToWorkbooks() ‘Step 1: Declare all the variables. Dim ws As Worksheet…

Group Worksheets by Color

If you assign colors to your Worksheet tabs, you may want to sort or group Worksheets based on their tab colors, but there’s no built-in tool to sort or group Worksheets by color in Excel, you need to drag and drop the sheet tabs on the sheet tab bar, if…

Sort Worksheets by Name

There’s no built-in tool to alphanumerically sort Worksheets in Excel. If you want to sort worksheets by name, you need to drag and drop the sheet tabs on the sheet tab bar. If you have multiple worksheets, it seems very boring to do it manually. In this situations, you can use…

Move or Copy Worksheets VBA

In Excel, you can manually move or copy a worksheet to another workbook by right-clicking the selected sheet and selecting the Move or Copy option, but, if you want to use Excel VBA to move or copy worksheets within a workbook or between workbooks, how to do it? Move Worksheets VBA Move…

Hide All Worksheets Except Active One

Sometimes, you may need to hide all Worksheets except active one, if the Workbook have many Worksheets, it seems very boring to do it manually. In these situations, you can use this simple macro. VBA Code Sub HideAllWorksheetsExceptActive() ‘Step 1: Declare your variables Dim ws As Worksheet ‘Step 2: Start…