View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
pallaver pallaver is offline
external usenet poster
 
Posts: 62
Default Remove characters

If you want that in Macro form - tweak the below as necessary. Also,
on a side note, how do you quickform notate A-Z and a-z instead of
writing it out longhand like I did.... I can't remember. Thanks.

Option Explicit
Const AlphaItems As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ"

Sub NameChanger()

Dim Position As Integer
Dim FullName As Variant
Dim ReturnName As String
Dim NameEntries As Range


Set NameEntries = Sheets("Sheet1").Range("A1:A3")

For Each FullName In NameEntries

MsgBox FullName
ReturnName = ""

For Position = 1 To Len(FullName) Step 1
If InStr(AlphaItems, Mid(FullName, Position, 1)) Then
ReturnName = ReturnName & UCase(Mid(FullName, Position, 1))
End If
Next Position

MsgBox ReturnName

Next


End Sub


On 7¤ë25¤é, ¤È«á4:36, Suraj Noorsai wrote:
If I a have a anme like O'Brien or De La Hoya or
Van-Basten, how do I remove the charcters from the names. I want my answer to be OBRIEN, DELAHOYA AND VANBASTER