What is your favourite small macro that improves productivity

Bassie

Board Regular
Joined
Jan 13, 2022
Messages
66
Office Version
  1. 2019
Platform
  1. Windows
Trying to come up with ideas for a new project and would love to hear your favourite produtvitiy boosting macros
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I use this simple one a lot and it saves a lot of time.

VBA Code:
Public Sub subFormatWorksheet(Ws As Worksheet)
Dim WsActive As Worksheet

    Set WsActive = ActiveSheet
    
    With Ws.Range("A1").CurrentRegion
        With .Rows(1)
            .Interior.Color = RGB(213, 213, 213)
            .Font.Bold = True
        End With
        .Font.Size = 14
        .Font.Name = "Arial"
        .RowHeight = 30
        .VerticalAlignment = xlCenter
        .IndentLevel = 1
        .EntireColumn.AutoFit
    End With
    
    With Ws.Range("A1").CurrentRegion.Borders
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = vbBlack
    End With

    If Not ActiveWindow.FreezePanes Then
        Ws.Activate
        Range("A2").Select
        ActiveWindow.FreezePanes = True
        Ws.Activate.Activate
    End If
        
End Sub
 
Upvote 1
Similar to what @Herakles posted above, but less elaborate. I have to view/analyze large data sets that people send me in my day job, and I use this a gazillion times a day.

VBA Code:
''' Format the header row
Sub FmtHeader()
    Dim WS As Worksheet
    Dim R As Range

    Set WS = ActiveSheet
    Set R = Application.Intersect(WS.UsedRange, WS.Rows(1).Cells)
    R.Font.Bold = True
    With R.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    WS.Range("A2").Select
    If Not ActiveWindow.FreezePanes Then
        ActiveWindow.FreezePanes = True
    End If
    WS.Columns.AutoFit
End Sub
 
Upvote 1

Forum statistics

Threads
1,223,935
Messages
6,175,493
Members
452,649
Latest member
mr_bhavesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top