Sureshaddin.xla
In the VBE, insert a Module (Right-click "VBAProject" > Insert > Module) and paste the following code. This recreates the core menu structure and common functions associated with this add-in.
' Code for ThisWorkbook or a Module to handle menus
Const MenuName As String = "Suresh Utilities"
Sub Auto_Open()
' Creates the menu item when Excel starts
Call CreateMenu
End Sub
Sub Auto_Close()
' Removes the menu item when Excel closes
Call DeleteMenu
End Sub
Sub CreateMenu()
Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup
Dim MenuItem As CommandBarControl
Dim SubMenuItem As CommandBarButton
' Delete the menu if it already exists
Call DeleteMenu
' Find the Help Menu position to insert before it
Set HelpMenu = CommandBars(1).FindControl(ID:=30010) ' ID for Help
' Create the main menu popup
Set NewMenu = CommandBars(1).Controls.Add(Type:=msoControlPopup, Before:=HelpMenu.Index, Temporary:=True)
NewMenu.Caption = MenuName
' --- ADD MENU ITEMS ---
' 1. Toggle Gridlines
Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "Toggle Gridlines"
.OnAction = "ToggleGridlines"
.FaceId = 364 ' Icon for grid
End With
' 2. Sheet Protection Tools
Set MenuItem = NewMenu.Controls.Add(Type:=msoControlPopup)
MenuItem.Caption = "Protection Tools"
' Sub-item: Protect All
Set SubMenuItem = MenuItem.Controls.Add(Type:=msoControlButton)
SubMenuItem.Caption = "Protect All Sheets"
SubMenuItem.OnAction = "ProtectAllSheets"
' Sub-item: Unprotect All
Set SubMenuItem = MenuItem.Controls.Add(Type:=msoControlButton)
SubMenuItem.Caption = "Unprotect All Sheets"
SubMenuItem.OnAction = "UnprotectAllSheets"
' 3. Case Changer
Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "Change Case to UPPERCASE"
.OnAction = "ChangeCaseUpper"
End With
' 4. Insert Row (A common utility)
Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "Insert Row After Selection"
.OnAction = "InsertRowAtSelection"
End With
End Sub
Sub DeleteMenu()
' Safely remove the menu
On Error Resume Next
CommandBars(1).Controls(MenuName).Delete
On Error GoTo 0
End Sub
Paste this below the menu code in the same Module. Sureshaddin.xla
' ------------------ FEATURE FUNCTIONS ------------------
Sub ToggleGridlines()
' Toggles gridlines for the active window
ActiveWindow.DisplayGridlines = Not ActiveWindow.DisplayGridlines
End Sub
Sub ProtectAllSheets()
Dim ws As Worksheet
Dim pwd As String
pwd = InputBox("Enter a password to protect all sheets (leave blank for no password):", "Protect Sheets")
For Each ws In ActiveWorkbook.Worksheets
If pwd <> "" Then
ws.Protect Password:=pwd
Else
ws.Protect
End If
Next ws
MsgBox "All sheets protected.", vbInformation
End Sub
Sub UnprotectAllSheets()
Dim ws As Worksheet
Dim pwd As String
pwd = InputBox("Enter the password to unprotect sheets (leave blank if no password):", "Unprotect Sheets")
On Error Resume Next
For Each ws In ActiveWorkbook.Worksheets
If pwd <> "" Then
ws.Unprotect Password:=pwd
Else
ws.Unprotect
End If
If Err.Number <> 0 Then
MsgBox "Incorrect password for sheet: " & ws.Name
Err.Clear
Exit Sub
End If
Next ws
On Error GoTo 0
MsgBox "All sheets unprotected.", vbInformation
End Sub
Sub ChangeCaseUpper()
Dim cell As Range
' Convert selected cells to Upper Case
On Error Resume Next
For Each cell In Selection
If cell.HasFormula = False Then
cell.Value = UCase(cell.Value)
End If
Next cell
End Sub
Sub InsertRowAtSelection()
' Inserts a row below the current selection
Dim rng As Range
Set rng = Selection
rng.Offset(1, 0).EntireRow.Insert
End Sub
You will now see a menu item called "Suresh Utilities" in your main Excel toolbar (usually near the Help menu). Inspect VBA:
It looks like you're referencing a file named Sureshaddin.xla — most likely an Excel Add-In (.xla extension, the legacy format for Excel add-ins before .xlam). Test safely:
Here’s what you should know:
Yes, but with caution.