Skip to main content

Posts

Macro to Delete Hidden Rows on Filtered Cells | VBA code to Delete Hidden Rows on Filtered Cells in Excel

Macro to Delete Hidden Rows on Filtered Cells | VBA code to Delete Hidden Rows on Filtered Cells in Excel 1. Open active excel sheet  2. Press Alt + F11 and Visual Basic Application window will open. 3. Go to Insert Menu and select new Module . 4. In new Module insert the below VBA Code and save it. 5. Before do the above process, excel sheet must save as Macro-Enabled. 6. To do Macro Enabled, open Excel Sheet and Click on the Office Button which is at left top corner on excel sheet. 7.  Select Save as and again select Macro Enabled Worksheet and then save it. VBA Code:  Sub DeleteBlankRows() Dim x As Long     With ActiveSheet     For x = .Cells.SpecialCells(xlCellTypeLastCell).Row _         To 1 Step -1             If WorksheetFunction.CountA(.Rows(x)) = 0 Then             ActiveSheet.Rows(x).Delete...
Recent posts

VBA Code to hide rows with number zeros in Excel | Macro to hide rows with number zeros in Excel

VBA Code to hide rows with number zeros in Excel | Macro to hide rows with number zeros in Excel  1. Open active excel sheet  2. Press Alt + F11 and Visual Basic Application window will open. 3. Go to Insert Menu and select new Module. 4. In new Module insert the below VBA Code and save it. 5. Before do the above process, excel sheet must save as Macro-Enabled. 6. To do Macro Enabled, open Excel Sheet and Click on the Office Button which is at left top corner on excel sheet. 7.  Select Save as and again select Macro Enabled Worksheet and then save it. VBA Code to Hide Rows With Zeros Sub HideRows() Dim cell As Range For Each cell In Range("J19:J33") If Not isEmpty(cell) Then If cell.Value = 0 Then  cell.EntireRow.Hidden = True End If End If Next End Sub

Macro to find Unique Values in excel | VBA Code to highlight unique values in excel

Macro to find Unique Values in excel | VBA Code to highlight unique values in excel 1. Open active excel sheet  2. Press Alt + F11 and Visual Basic Application window will open. 3. Go to Insert Menu and select new Module. 4. In new Module insert the below VBA Code and save it. 5. Before do the above process, excel sheet must save as Macro-Enabled. 6. To do Macro Enabled, open Excel Sheet and Click on the Office Button which is at left top corner on excel sheet. 7.  Select Save as and again select Macro Enabled Worksheet and then save it. Sub highlightUniqueValues() Dim rng As Range Set rng = Selection rng.FormatConditions.Delete Dim uv As UniqueValues Set uv = rng.FormatConditions.AddUniqueValues uv.DupeUnique = xlUnique uv.Interior.Color = vbGreen End Sub

VBA Code to create shortcut key to paste special using in Excel | Macro to create shortcut key to paste special using in Excel

VBA Code to create shortcut key to paste special using in Excel | Macro to create shortcut key to paste special using in Excel 1. Open active excel sheet  2. Press Alt + F11 and Visual Basic Application window will open. 3. Go to Insert Menu and select new Module. 4. In new Module insert the below VBA Code and save it. 5. Before do the above process, excel sheet must save as Macro-Enabled. 6. To do Macro Enabled, open Excel Sheet and Click on the Office Button which is at left top corner on excel sheet. 7.  Select Save as and again select Macro Enabled Worksheet and then save it. VBA Code: Sub PasteVal()     Selection.PasteSpecial Paste:=xlValues End Sub

VBA Code to delete hidden rows in Excel Sheet after filter | Macro Code to delete hidden rows in Excel Sheet after filter

VBA Code to delete hidden rows in Excel Sheet after filter | Macro Code to delete hidden rows in Excel Sheet after filter  Open Excel sheet and Press Alt F11 Click on Insert Button and Insert new module Paste the below code and save. Before saving the code you must enable the sheet as Macro Enabled Sheet. Sub deletehidden() For lp = 256 To 1 Step -1 If Columns(lp).EntireColumn.Hidden = True Then Columns(lp).EntireColumn.Delete Else Next For lp = 65536 To 1 Step -1 If Rows(lp).EntireRow.Hidden = True Then Rows(lp).EntireRow.Delete Else Next End Sub

VBA Code to Add Serial Number in Excel Sheet | Macro to Add serial numbers in Excel

VBA Code to Add Serial Number in Excel Sheet | Macro to Add serial numbers in Excel  Its is very easy to add numbers sequentially in Excel by using VBA code. Step 1: Open excel sheet and Press Alt + F11 Button Step 2: Go to the Insert Tab and select new Module Step3: Copy the below code and then save it. Step 4: Click on F2 to run the VBA Code. Sub AddSerialNumbers() Dim i As Integer OnError GoTo Last I=InputBox(“Enter”,”Enter Serial Numnbers”) For i = 1 to i ActiveCell.value = i ActiveCell.Offset(1,0).Active Next i Last:Exit Sub End Sub