Results 1 to 13 of 13

Return value only if all words are uppercase

Threaded View

  1. #4
    Forum Contributor
    Join Date
    02-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    187

    Re: Return value only if all words are uppercase

    This should do it:

    Sub Test()
    Dim l As Integer
    Dim Text As String
    
    lastrow = ActiveSheet.UsedRange.Rows.Count
    
    For i = 1 To lastrow
        Text = Cells(i, 1).Value
        l = Len(Text)
        For x = 1 To l
        If Mid(Text, x, 1) Like "[A-Z]" Or Mid(Text, x, 1) Like " " Then
            Cells(i, 2).Value = "TRUE"
        Else
            Cells(i, 2).Value = "FALSE"
            Exit For
        End If
        Next x
    Next i
    End Sub
    It assumes all your input values are in row 'A', and will then output True/False in Row 'B'.

    Let me know if it works!
    Last edited by TKCZBW; 04-16-2014 at 05:38 AM. Reason: Extraneous variable

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 06-05-2014, 02:50 AM
  2. How to uppercase selected words?
    By jgomez in forum Access Tables & Databases
    Replies: 5
    Last Post: 03-27-2012, 06:59 PM
  3. Extract uppercase words from string
    By agf12555 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2011, 11:30 AM
  4. Extract uppercase words from string
    By agf12555 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2011, 03:05 PM
  5. VB - Making first letters of words uppercase
    By Smurlos in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2010, 08:10 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1