Excel Tutorials | Macros Code

Closing Message

Sub auto_close() MsgBox “Bye Bye! Don’t forget to check other cool stuff on xlsxtemplates.com” End Sub Closing Message Excel macro code:  You can use close_open

Read More »

Unhide all Rows and Columns

Sub UnhideRowsColumns() Columns.EntireColumn.Hidden = False Rows.EntireRow.Hidden = False End Sub Unhide all Rows and Columns in excel: Instead of unhiding rows and columns on by

Read More »

Delete all Blank Worksheets

Sub deleteBlankWorksheets() Dim Ws As Worksheet On Error Resume Next Application.ScreenUpdating= False Application.DisplayAlerts= False For Each Ws In Application.Worksheets If Application.WorksheetFunction.CountA(Ws.UsedRange) = 0 Then Ws.Delete

Read More »

Sort Worksheets

Sub SortWorksheets() Dim i As Integer Dim j As Integer Dim iAnswer As VbMsgBoxResult iAnswer = MsgBox(“Sort Sheets in Ascending Order?” & Chr(10) _ &

Read More »

Protect all the Cells With Formulas

Sub lockCellsWithFormulas() With ActiveSheet .Unprotect .Cells.Locked = False .Cells.SpecialCells(xlCellTypeFormulas).Locked = True .Protect AllowDeletingRows:=True End With End Sub Protect all the Cells With Formulas with a

Read More »

Disable Page Breaks

Sub DisablePageBreaks() Dim wb As Workbook Dim wks As Worksheet Application.ScreenUpdating = False For Each wb In Application.Workbooks For Each Sht In wb.Worksheets Sht.DisplayPageBreaks =

Read More »

Protect Worksheet

Sub ProtectWS() ActiveSheet.Protect “mypassword”, True, True End Sub If you want to protect your worksheet you can use this macro code. All you have to

Read More »

UnProtect Worksheet

Sub UnprotectWS() ActiveSheet.Unprotect “mypassword” End Sub UnProtect Worksheet If you want to unprotect your worksheet you can use this macro code. All you have to

Read More »