Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-30-2014, 09:21 PM
macropod's Avatar
macropod macropod is offline How to get the Right function to return a string that has UPPERCASE letters only Windows 7 64bit How to get the Right function to return a string that has UPPERCASE letters only Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim StrOut As String
StrOut = " "
With Selection.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[A-Z]{2,}-[0-9A-Z\-]{1,}"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    If InStr(StrOut, " " & .Text & " ") = 0 Then StrOut = StrOut & .Text & " "
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
  .InsertAfter vbCr & Replace(Trim(StrOut), " ", ", ") & vbCr
End With
Application.ScreenUpdating = True
End Sub
With this code, each item will be listed once in the output, regardless of how often it appears in the input.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
right function, upper



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the Right function to return a string that has UPPERCASE letters only Uppercase formula? clements55 Excel 1 08-20-2014 11:34 PM
How to get the Right function to return a string that has UPPERCASE letters only Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
How to get the Right function to return a string that has UPPERCASE letters only Can I use the filter function to separate letters into separate files? drhauser Mail Merge 2 12-14-2011 02:18 PM
How to get the Right function to return a string that has UPPERCASE letters only Day and Month to Uppercase Andy2011 Word VBA 1 07-22-2011 04:34 PM
How to get the Right function to return a string that has UPPERCASE letters only Macro or Function to know wether a string is included in a text Eduardo Word VBA 5 06-15-2009 01:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft