Excel Tutorials | Macros Code

Highlight Difference in Rows

Sub rowDifference() Range(“H7:H8,I7:I8”).Select Selection.RowDifferences(ActiveCell).Select Selection.Style= “Bad” End Sub You can Highlight Difference in Rows (corresponding cells) by using this VBA Macro Code in Excel

Read More »

Custom Header & Footer

Sub CustomHeader() Dim myText As String myText = InputBox(“Enter your text here”, “Enter Text”) With ActiveSheet.PageSetup .LeftHeader = “” .CenterHeader = myText .RightHeader = “”

Read More »

Add Header and Footer Date

Sub DateInHeader() With ActiveSheet.PageSetup .LeftHeader = “” .CenterHeader = “&D” .RightHeader = “” .LeftFooter = “” .CenterFooter = “” .RightFooter = “” End With End

Read More »

Unmerge Cells

Sub UnmergeCells() Selection.UnMerge End Sub Unmerge Cells code simply uses the unmerge options which you have on the HOME‌ tab. The benefit of using this

Read More »

Open Calculator

Sub OpenCalculator() Application.ActivateMicrosoftApp Index:=0 End Sub In Windows, there is a specific calculator and by using this macro code you can open that calculator directly

Read More »

Auto Fit Rows

Sub AutoFitRows() Cells.Select Cells.EntireRow.AutoFit End Sub You can use this code to auto-fit all the rows in a worksheet. When you run this code it

Read More »

Remove Text Wrap

Sub RemoveTextWrap() Range(“A1”).WrapText = False End Sub This code will help you to remove text wrap from the entire worksheet with a single click. It

Read More »

Auto Fit Columns

Sub AutoFitColumns() Cells.Select Cells.EntireColumn.AutoFit End Sub Use above Excel macro code to auto fit rows in all your sheet at once This code quickly auto

Read More »

Insert Multiple Columns

Sub InsertMultipleColumns() Dim i As Integer Dim j As Integer ActiveCell.EntireColumn.Select On Error GoTo Last i = InputBox(“Enter number of columns to insert”, “Insert Columns”)

Read More »