Advertisement
Guest User

ContarLetra

a guest
Sep 30th, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Function contarletra(letra As String, Celda As Range)
  2.     Dim nCount, i As Integer
  3.     Dim sTexto As String
  4.    
  5.     sTexto = LCase(Celda.Value)
  6.     nCount = 0
  7.    
  8.     For i = 1 To Len(sTexto)
  9.         If Mid(sTexto, i, 1) = LCase(letra) Then
  10.             nCount = nCount + 1
  11.         End If
  12.     Next i
  13.     contarletra = nCount
  14. End Function
  15.  
Tags: excel vba
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement