Finding Uppercase Words in String?
Use this direct method to find out whether any lengthy string has words with all Caps.
For example: This line has one WORD as all caps.
If a word has all letters in caps, then it might denote some important keyword. In that case, to find it, use this tiny code.Find All Capital Words in a Sentence String using Excel VBAVisual Basic1234567891011121314Sub Find_All_Capital_Word()Dim iStr As String, iArr As Variant, idx As DoubleiStr = ThisWorkbook.Sheets(1).Cells(1, 1)iStr = VBA.Replace(iStr, " ", " ", , , vbTextCompare)iArr = VBA.Split(iStr, " ", , vbTextCompare)For idx = 0 To UBound(iArr)If iArr(idx) = VBA.UCase(iArr(idx)) ThenThisWorkbook.Sheets(1).Cells(idx + 1, 2) = iArr(idx)End IfNextEnd Sub
The above code gets the sentence in a string variable. Then splits it into an array of variables that hold each word. Now each word is verified whether it is equivalent to its own replica of all capital letters.
If there is a match found, then it is reported as a word with all capital letters.
Previous Post: How To Convert – PDF To Word Document?
Next Post: Number of Working Days in a Year – Between Two Dates – Excel
Excel VBA – Find UpperCase Word in String or Worksheet
- Block Apps in FaceBook print screen Excel Countif Record Macro Timer in Excel Task Manager VCF HTML Table Import Data Thumbnails Text to Speech TTS Candy Crush C++ Programing Machine learning AI bulk email Excel VBA vba color index vba color codes Android social media Twitter Google+ Google Adsense Tips bitcoin Calendar in Excel outlook vba mass email Data Mining Excel Macro Facebook WhatsApp python Wordpress