Remove Decimals from Numbers
Sub removeDecimals() Dim lnumber As Double Dim lResult As Long Dim rng As Range For Each rng In Selection rng.Value = Int(rng) rng.NumberFormat = “0”
Sub removeDecimals() Dim lnumber As Double Dim lResult As Long Dim rng As Range For Each rng In Selection rng.Value = Int(rng) rng.NumberFormat = “0”
Sub removeApostrophes() Selection.Value = Selection.Value End Sub VBA Macro Code to Remove the Apostrophe from a Number in Excel If you have numeric data where
Sub addNumber() Dim rng As Range Dim i As Integer i = InputBox(“Enter number to multiple”, “Input Required”) For Each rng In Selection If WorksheetFunction.IsNumber(rng)
Sub removeTime() Dim Rng As Range For Each Rng In Selection If IsDate(Rng) = True Then Rng.Value = VBA.Int(Rng.Value) End If Next Selection.NumberFormat = “dd-mmm-yy”
Sub addNumber() Dim rng As Range Dim i As Integer i = InputBox(“Enter number to multiple”, “Input Required”) For Each rng In Selection If WorksheetFunction.IsNumber(rng)
Sub convertLowerCase() Dim Rng As Range For Each Rng In Selection If Application.WorksheetFunction.IsText(Rng) Then Rng.Value= LCase(Rng) End If Next End Sub This code will help
Sub removeChar() Dim Rng As Range Dim rc As String rc = InputBox(“Character(s) to Replace”, “Enter Value”) For Each Rng In Selection Selection.Replace What:=rc, Replacement:=””
Sub convertProperCase() Dim Rng As Range For Each Rng In Selection If WorksheetFunction.IsText(Rng) Then Rng.Value = WorksheetFunction.Proper(Rng.Value) End If Next End Sub And this code
Sub convertUpperCase() Dim Rng As Range For Each Rng In Selection If Application.WorksheetFunction.IsText(Rng) Then Rng.Value = UCase(Rng) End If Next End Sub VBA Macro code
Sub date2year() Dim tempCell As Range Selection.Value = Selection.Value For Each tempCell In Selection If IsDate(tempCell) = True Then With tempCell .Value = Year(tempCell) .NumberFormat
Sub removeDate() Dim Rng As Range For Each Rng In Selection If IsDate(Rng) = True Then Rng.Value = Rng.Value – VBA.Fix(Rng.Value) End If NextSelection.NumberFormat =
Sub replaceBlankWithZero() Dim rng As Range Selection.Value = Selection.Value For Each rng In Selection If rng = “” Or rng = ” ” Then rng.Value
Get organized with our free, customizable Excel templates
© 2023 xlsxtemplates all rights reserved