Copy Active Worksheet into a New Workbook
Sub CopyWorksheetToNewWorkbook() ThisWorkbook.ActiveSheet.Copy _ Before:=Workbooks.Add.Worksheets(1) End Sub Copy Active Worksheet into a New Workbook Let’s say if you want to copy your active worksheet in
Sub CopyWorksheetToNewWorkbook() ThisWorkbook.ActiveSheet.Copy _ Before:=Workbooks.Add.Worksheets(1) End Sub Copy Active Worksheet into a New Workbook Let’s say if you want to copy your active worksheet in
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
Sub FileBackUp() ThisWorkbook.SaveCopyAs Filename:=ThisWorkbook.Path & _ “” & Format(Date, “mm-dd-yy”) & ” ” & _ ThisWorkbook.name End Sub Create a Backup of a Current Workbook
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
Sub SaveWorkshetAsPDF() Dimws As Worksheet For Each ws In Worksheets ws.ExportAsFixedFormat _ xlTypePDF, _ “ENTER-FOLDER-NAME-HERE” & _ ws.Name & “.pdf” Next ws End Sub Save
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
Sub SortWorksheets() Dim i As Integer Dim j As Integer Dim iAnswer As VbMsgBoxResult iAnswer = MsgBox(“Sort Sheets in Ascending Order?” & Chr(10) _ &
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
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 =
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
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
Sub Resize_Charts() Dim i As Integer For i = 1 To ActiveSheet.ChartObjects.Count With ActiveSheet.ChartObjects(i) .Width = 300 .Height = 200 End With Next i End
Welcome to Excel Templates – your ultimate destination for all things related to Excel! We pride ourselves on being a comprehensive, 100% free platform dedicated to providing top-notch, easily editable Excel templates, step-by-step tutorials, and useful macro codes. With fresh templates uploaded daily, we aim to meet every conceivable Excel need you may have. Whether you’re a student, a business professional, or someone looking to make sense of their data, our range of templates has you covered. Dive into the world of Excel Templates today and transform your number-crunching experience into an effortless journey of discovery and efficiency. Join our growing community and elevate your Excel game now.
© 2023 xlsxtemplates all rights reserved