Excel usedrange not updating
Save As "C: Users Username Desktop Workbook Name" & timestamp End Sub You need to specify the folder location and the file name.
In the above code, "C: Users Username Desktop is the folder location I have used.
In this massive article, I am going to list some useful Excel macro examples that I need often and keep stashed away in my private vault.
I will keep updating this tutorial with more macro examples.
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.
Screen Updating = False Dim Sh Count As Integer, i As Integer, j As Integer Sh Count = Sheets.
While writing an Excel VBA macro code may take some time initially, once it's done, you can keep it available as a reference and use it whenever you need it next.Protect password:=password Next ws End Sub'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 Worksheetsws.Unprotect password:=password Next ws End Sub It's a common practice to merge cells to make it one.Also, each PDF will get the same name as that of the worksheet. Protect Allow Deleting Rows:=True End With End Sub'This code will insert a row after every row in the selection Sub Insert Alternate Rows()Dim rng As Range Dim Count Row As Integer Dim i As Integer Set rng = Selection Count Row = rng. Note that you need to insert this code in the worksheet code window (and not the in module code window as we have done in other Excel macro examples so far).You will have to modify this folder location (unless your name is also Sumit and you're saving it in a test folder on the desktop). To do this, in the VB Editor, double click on the sheet name on which you want this functionality.