Sub SubZero()
‘
‘ SubZero Macro
‘
‘
ActiveWindow.DisplayZeros = False
End Sub
Sub ShowZero()
‘
‘ ShowZero Macro
‘
‘
ActiveWindow.DisplayZeros = True
End Sub
Sub AddCustomFooter()
Dim inputText As String
inputText = InputBox(“Enter your text for the custom footer”, “Custom Footer”)
‘Add your custom text to the right footer
With ActiveSheet.PageSetup
.LeftFooter = “”
.CenterFooter = “”
.RightFooter = inputText
End With
End Sub
Sub PasswordBreaker()
‘Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox “One usable password is ” & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub
Sub SelectAllUnlockedCells()
Dim c As Range
Dim unlockedCells As Range
Dim fullRange As Range
Dim rangeDescription As String
‘Count cells in selection .If 1 cell then search used range
‘otherwise search the selected range
If Selection.Cells.Count > 1 Then
Set fullRange = Selection
rangeDescription = “selected cells”
Else
Set fullRange = ActiveSheet.UsedRange
rangeDescription = “active range”
End If
‘Loop through each cell in the chosen range of active sheet
For Each c In fullRange
If c.Locked = False Then
‘If find first cell set the variable, otherwise add
‘to existing list of cells
If unlockedCells Is Nothing Then
Set unlockedCells = c
Else
Set unlockedCells = Union(unlockedCells, c)
End If
End If
Next
‘Select the range of unlocked cells
If Not unlockedCells Is Nothing Then
unlockedCells.Select
Else
MsgBox “There are no unlocked cells in the ” _
& rangeDescription & “: ” & fullRange.Address
End If
End Sub
Sub SelectByColour() ‘Includes active cell
Dim Kolor As Long, Cel As Range, Rng As Range
Kolor = ActiveCell.DisplayFormat.Interior.Color
Set Rng = ActiveCell
For Each Cel In ActiveSheet.UsedRange
If Cel.DisplayFormat.Interior.Color = Kolor Then Set Rng = Union(Rng, Cel)
Next Cel
If Not Rng Is Nothing Then Rng.Select
End Sub
Sub SelectOtherByColour() ‘Excludes active cell
Dim Kolor As Long, Cel As Range, Rng As Range
Kolor = ActiveCell.DisplayFormat.Interior.Color
For Each Cel In ActiveSheet.UsedRange
If Not Cel.Address = ActiveCell.Address Then
If Cel.DisplayFormat.Interior.Color = Kolor Then
If Not Rng Is Nothing Then Set Rng = Union(Rng, Cel) Else Set Rng = Cel
End If
End If
Next Cel
If Not Rng Is Nothing Then Rng.Select
End Sub