Instantly share code, notes, and snippets.

View CalculateSelection.bas
' These macros are meant to be used with Manual Calculation to just
' calculate the selected cells. The verbose macro shows the
' progress of the calculation by showing what current cell is
' calculating out of the total number of cells. The verbose macro also
' displays how long the macro took to finish.
Option Explicit
' ----------------------------------------------------------------
' Procedure Name: CalculateSelection
View SheetExists.bas
' ----------------------------------------------------------------
' Procedure Name: SheetExists
' Purpose: Determine whether or not a sheet/tab exists
' Procedure Kind: Function
' Procedure Access: Public
' Return Type: Boolean
' Author: sb172a
' Date: 8/10/2018
' ----------------------------------------------------------------
Function SheetExists(SheetName As String, Optional GivenWorkbook As Workbook) As Boolean
View AlphaNumericOnly.bas
' ----------------------------------------------------------------
' Procedure Name: AlphaNumericOnly
' Purpose: Removes non-alpha numeric characters from the given string
' Procedure Kind: Function
' Procedure Access: Public
' Parameter SourceString (String): the string to remove non alpha numeric values from
' Return Type: String
' Author: sb172a
' Date: 8/9/2018
' ----------------------------------------------------------------
View TabName.bas
' ----------------------------------------------------------------
' Procedure Name: TabName
' Purpose: Returns the current sheet/tab name
' Procedure Kind: Function
' Procedure Access: Public
' Author: sb172a
' Date: 7/3/2018
' ----------------------------------------------------------------
Function TabName()
TabName = Application.Caller.Worksheet.Name
View TextToNumber.bas
' When comparing these methods, a few tests were done to test their efficiency...
' Test 1: one column, 100,000 total text numbers in the column
' SelectionToNumberInPlace Time: 2.122 seconds
' SelectionToNumberColumn Time: 4.124 seconds
' Test 2: one column, 1,048,576 total text numbers in the column
' SelectionToNumberInPlace Time: 18.1218 seconds
' SelectionToNumberColumn Time: 15.1213 seconds
' Test 3: two columns, 2,097,152 total text numbers in the columns
' SelectionToNumberInPlace Time: 24.1224 seconds
' SelectionToNumberColumn Time: 31.1231 seconds
View RemovePrintLines.bas
' ----------------------------------------------------------------
' Procedure Name: RemovePrintLines
' Purpose: Remove all dotted/dashed print lines in the workbook
' Procedure Kind: Sub
' Procedure Access: Public
' Author: sb172a
' Date: 7/3/2018
' ----------------------------------------------------------------
Sub RemovePrintLines()
Application.ScreenUpdating = False
View ToggleGridlines.bas
' ----------------------------------------------------------------
' Procedure Name: ToggleGridlines
' Purpose: Toggle the gridlines for all the sheets in the workbook
' Procedure Kind: Sub
' Procedure Access: Public
' Author: sb172a
' Date: 7/9/2018
' ----------------------------------------------------------------
Sub ToggleGridlines()
Application.ScreenUpdating = False
View ToggleHeadings.bas
' Procedure Name: ToggleHeadings
' Purpose: Toggle the cell headings for all the sheets in the workbook
' Procedure Kind: Sub
' Procedure Access: Public
' Author: sb172a
' Date: 7/9/2018
' ----------------------------------------------------------------
Sub ToggleHeadings()
Application.ScreenUpdating = False
Dim WS As Worksheet, InitialSheet As Worksheet
View ToggleFormulaBar.bas
' ----------------------------------------------------------------
' Procedure Name: ToggleFormulaBar
' Purpose: Toggle the application to show/hide formula bar
' Procedure Kind: Sub
' Procedure Access: Public
' Author: sb172a
' Date: 7/9/2018
' ----------------------------------------------------------------
Sub ToggleFormulaBar()
Application.DisplayFormulaBar = Not Application.DisplayFormulaBar
View ToggleRibbon.bas
' ----------------------------------------------------------------
' Procedure Name: ToggleRibbon
' Purpose: Toggle the visibilty of the Excel ribbon and menu bars
' Procedure Kind: Sub
' Procedure Access: Public
' Author: sb172a
' Date: 7/11/2018
' ----------------------------------------------------------------
Sub ToggleRibbon()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"", " & CStr(Not Application.CommandBars("Ribbon").Visible) & ")"