Forum Discussion

Excel's avatar
Excel
Iron Contributor
Sep 01, 2022
Solved

Related to VBA code

Hello everyone,  I want to calculate LEN function of Column K with the help of VBA code. I have written the code for the function now i want result to displayed in n column can you help me to write...
  • HansVogelaar's avatar
    Sep 01, 2022

    Excel 

    Try this:

    Sub Test()
        Dim m As Long
        m = Range("K" & Rows.Count).End(xlUp).Row
        With Range("N2:N" & m)
            .Formula = "=LEN(K2)-LEN(SUBSTITUTE(K2,"","",""""))"
            .Value = .Value
        End With
    End Sub

Resources