Screenupdating false macro am dating my best friend
Screen Updating = False Dim Sh Count As Integer, i As Integer, j As Integer Sh Count = Sheets.
Count For i = 1 To Sh Count - 1For j = i 1 To Sh Count If Sheets(j).
Also, I have used a generic name "Workbook Name" as the filename prefix.
You can specify something related to your project or company.
If you have a workbook with many worksheets and you want to sort these alphabetically, this macro code can come in really handy.
This could be the case if you have sheet names as years or employee names or product names.'This code will sort the worksheets alphabetically Sub Sort Sheets Tab Name()Application.
In case the example says that you need to paste the code in the worksheet code window, double click on the worksheet object and copy paste the code in the code window. Once you have copied the code in the VB Editor, here are the steps to run the macro: In case the code is pasted in the worksheet code window, you don't need to worry about running the code.
While it could be a time-consuming process if done manually, VBA can really speed it up. Select Next i End Sub Similarly, you can modify this code to insert a blank column after every column in the selected range.
Here is the code that will automatically save the workbook in the specified folder and add a timestamp whenever it's saved.'This code will Save the File With a Timestamp in its name Sub Save Workbook With Time Stamp()Dim timestamp As Stringtimestamp = Format(Date, "dd-mm-yyyy") & "_" & Format(Time, "hh-ss")This Workbook.
Save As "C: Users Username Desktop Workbook Name" & timestamp End Sub You need to specify the folder location and the file name.
Name If you have a lot of worksheets in a workbook and you want to protect all the sheets, you can use this macro code.
It allows you to specify the password within the code.
You will need this password to unprotect the worksheet.'This code will protect all the sheets at one go Sub Protect All Sheets()Dim ws As Worksheet Dim password As Stringpassword = "Test123" 'replace Test123 with the password you want For Each ws In Worksheets ws.