Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default return used letters in a range function - an example

no question here, just a custom function for the archive.

Function LettersUsedReturn(TrgtCellOrRange As Range) As String

'Evaluate a cell or range for the presence of standard English letters
and the letter type(s) used in the cell or range.

Dim myRng As Range
Dim myChars(11 To 36) As String
Dim iCtr As Long
Dim curWks As Worksheet
Dim myFormula As String
Dim LetterArray As String

'A to Z
For iCtr = 11 To 36
myChars(iCtr) = Chr(65 + iCtr - 11)
Next iCtr

With TrgtCellOrRange
Set myRng = Nothing
On Error Resume Next

Set myRng = TrgtCellOrRange
On Error GoTo 0

For iCtr = LBound(myChars) To UBound(myChars)

myFormula = "sum(len(upper(" & _
myRng.Address(external:=True) & "))" _
& "-len(substitute(upper(" & _
myRng.Address(external:=True) _
& "),""" & myChars(iCtr) & ""","""")))"
'
'Create the array of Letters whose count is 0
If Evaluate(myFormula) 0 Then

LetterArray = myChars(iCtr) + LetterArray

End If
Next iCtr
End With

If LetterArray = "" Then
LettersUsedReturn = "There are no letters present in current
target range."
Else
LettersUsedReturn = StrReverse(LetterArray)
End If
End Function






Search criteria:
test for presence of letters
return used letters in range
evaluate for presence of letter or letters
return an array of used letters
check for letters in a cell
used letters return
what letters are used in range or cell?
unique letters returned
extract unique letters
alphabetical order of letters in cell
what letters are present

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
function like INDIRECT to return a range? Wilba Excel Worksheet Functions 4 November 17th 07 04:42 AM
I would like a function to return a value that fits its range rpbsr Excel Worksheet Functions 4 September 7th 06 06:49 PM
return range of data from lookup function Boom1 Excel Worksheet Functions 0 August 18th 06 05:13 PM
return range of data from lookup function Boom1 Excel Worksheet Functions 0 August 18th 06 05:13 PM
VBA function to return letters of alphabet SOS[_19_] Excel Programming 5 May 20th 04 07:44 PM


All times are GMT +1. The time now is 06:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"