Forum Discussion
Excel
Sep 01, 2022Iron Contributor
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...
- Sep 01, 2022
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
HansVogelaar
Sep 01, 2022MVP
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