Sub FPS_Wise_Count() Application.ScreenUpdating = False Application.EnableEvents = False Range("A8").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select Selection.Copy Sheets.Add ActiveSheet.Paste Dim Col As Long, ColCnt As Long, rng As Range Application.Calculation = xlCalculationManual On Error GoTo Exits: If Selection.Columns.Count > 1 Then Set rng = Selection Else Set rng = Range(Columns(1), Columns(ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Column())) End If ColCnt = 0 For Col = rng.Columns.Count To 1 Step -1 If Application.WorksheetFunction.CountA(rng.Columns(Col).EntireColumn) = 0 Then rng.Columns(Col).EntireColumn.Delete ColCnt = ColCnt + 1 End If Next Col Exits: Range("F1:I1").UnMerge Range("F1:G1").Merge Range("H1:I1").Merge Range("H1:I1").FormulaR1C1 = "Verified Aadhar" Range("H2").FormulaR1C1 = "Family" Range("I2").FormulaR1C1 = "Member" Range("J1:K1").FormulaR1C1 = "Balance to Seed" Range("M1:O1").UnMerge Range("L1:M1").Merge Range("L1:M1").FormulaR1C1 = "Validation Pending" Range("L2").FormulaR1C1 = "Family" Range("M2").FormulaR1C1 = "Member" Range("N2").FormulaR1C1 = "Mismatch Member %" Range("O:O").EntireColumn.Delete Range("J3:N4").Select Range(Selection, Selection.End(xlDown)).ClearContents Range("H1:N3").Select Range(Selection, Selection.End(xlDown)).Borders.LineStyle = xlContinuous Rows("1:2").RowHeight = 25 Range("A1:N2").Select With Selection .Borders.LineStyle = xlContinuous .VerticalAlignment = xlCenter .WrapText = True End With With Selection.Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With Columns("C:C").ColumnWidth = 24 Columns("B:B").ColumnWidth = 12.56 Columns("A:A").ColumnWidth = 3 Range("J3").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=RC[-6]-RC[-4]" Range("K3").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=RC[-6]-RC[-4]" Range("L3").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=RC[-6]-RC[-4]" Range("M3").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=RC[-6]-RC[-4]" Range("J3:M3").Select Application.CutCopyMode = False Selection.Copy Range("I3").End(xlDown).Select ActiveCell.Offset(0, 1).Range("A1").Select Range(Selection, Selection.End(xlUp)).Select ActiveSheet.Paste Range("D3").End(xlDown).Select ActiveCell.EntireRow.EntireRow.Delete Selection.Delete Shift:=xlUp Range("B3").Select Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13), _ Replace:=True, PageBreaks:=False, SummaryBelowData:=True Range("A1:C1").UnMerge Range("A1:A2").Merge Range("B1:B2").Merge Range("C1:C2").Merge Range("N1:N2").Merge Rows("1:1").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove Range("N4").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-7]%" Range("N4").NumberFormat = "0.00" Range("N4").Select Application.CutCopyMode = False Selection.Copy Range("I4").End(xlDown).Select ActiveCell.Offset(0, 5).Range("A1").Select Range(Selection, Selection.End(xlUp)).Select ActiveSheet.Paste Range("A4", Range("A4").End(xlToRight).End(xlDown)).Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$C4=""""" Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority With Selection .WrapText = False End With With Selection.FormatConditions(1).Font .Bold = True .Italic = False .TintAndShade = 0 End With With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = RGB(0, 255, 255) .TintAndShade = 0 End With Range("A4", Range("A4").End(xlToRight).End(xlDown)).Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$N4>10" Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Bold = True .Italic = False .TintAndShade = 0 End With With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = RGB(255, 255, 0) .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("A4", Range("A4").End(xlToRight).End(xlDown)).Select With Selection .Borders.LineStyle = xlContinuous .VerticalAlignment = xlCenter .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False End With Range("D4", Range("D4").End(xlToRight).End(xlDown)).Select With Selection.Font .Name = "Arial" .Size = 11 End With Application.PrintCommunication = False With ActiveSheet.PageSetup .PrintTitleRows = "$1:$3" .PrintTitleColumns = "" .LeftMargin = Application.InchesToPoints(0.3) .RightMargin = Application.InchesToPoints(0.3) .TopMargin = Application.InchesToPoints(0.128) .BottomMargin = Application.InchesToPoints(0.3) .HeaderMargin = Application.InchesToPoints(0.07) .FooterMargin = Application.InchesToPoints(0.07) .PrintQuality = 300 .Orientation = xlLandscape .PaperSize = xlPaperA4 .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .Zoom = 100 .ScaleWithDocHeaderFooter = True .AlignMarginsHeaderFooter = True .CenterFooter = "Page &P of &N" End With Rows("4:720").EntireRow.RowHeight = 20 Columns("J:M").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("J3").Select ActiveCell.FormulaR1C1 = "Family" Range("K3").Select ActiveCell.FormulaR1C1 = "Member" Range("L3").Select ActiveCell.FormulaR1C1 = "Family" Range("M3").Select ActiveCell.FormulaR1C1 = "Member" Range("J2:K2").Merge Range("L2:M2").Merge Range("J2:K2").Select ActiveCell.FormulaR1C1 = "Y Day Pending" Range("L2:M2").Select ActiveCell.FormulaR1C1 = "Daily Validation" Range("L4").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=RC[-2]-RC[4]" Range("M4").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=RC[-2]-RC[4]" Range("L4:M4").Select Selection.Copy Range("I3").End(xlDown).Select ActiveCell.Offset(0, 3).Range("A1").Select Range(Selection, Selection.End(xlUp)).Select ActiveSheet.Paste Rows("1:1").RowHeight = 24.6 Range("A1:O1").Merge Range("A1:O1").Select Range("A1:O1").FormulaR1C1 = "FPS WISE AADHAR SEEDING & VALIDATION REPORT OF GANJAM DISTRICT AS ON" Range("P1:R1").Merge Range("P1:R1").Select ActiveCell.FormulaR1C1 = "=today()" Range("A1:O1", "P1:R1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .ReadingOrder = xlContext .Font.Name = "Arial" .Font.Size = 16 .Font.Bold = True End With Range("B4").End(xlDown).Select ActiveCell.Offset(0, -1).Range("A1").Select Range(Selection, Range("A4")).Select With Selection .VerticalAlignment = xlCenter .HorizontalAlignment = xlCenter .ShrinkToFit = True End With Range("B4").End(xlDown).Font.Size = 14 Range("B4").End(xlDown).Select ActiveCell.EntireRow.EntireRow.RowHeight = 30 Columns("L:P").ColumnWidth = 6 Columns("Q").ColumnWidth = 7 Columns("R").ColumnWidth = 6 Range("L4").Select Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True Application.EnableEvents = True End Sub