Calculate Len of range of cell in VBA -
i looking vba code me in calculating no of characters in range of cells.
if use excel option of len, gives me no of characters in particular cell.
do have code give me no of characters in range of cells.
for ex; a1 = "night" , b1 = "day" c1 = "noon"
the result should 12 ( 5 + 3 + 4 )
can 1 me this
you can create custom udf, using loop calculate number of characters in range, code below:
function sumleninrange(rng range) long dim c range each c in rng ' loop through cells in range sumleninrange = sumleninrange + len(c.value2) next c end function
and use test sub
code below:
sub test() msgbox "num of characters in range : " & sumleninrange(range("a1:c1")) end sub
Comments
Post a Comment