Macro
I have written the Macro below in Excel that returns the generic # for
number and @ for a letter e.g. 'abc123' would be '@@@###':
Public Function Kabi_it(thing)
Dim work1
For i = 1 To Len(thing)
If (Asc(Mid(thing, i, 1)) 96) And (Asc(Mid(thing, i, 1)) < 123)
Then
work1 = work1 & "@"
ElseIf (Asc(Mid(thing, i, 1)) 64) And (Asc(Mid(thing, i, 1)) <
91) Then
work1 = work1 & "@"
Else
work1 = work1 & "#"
End If
Next
Kabi_it = work1
End Function
I have two questions:
1) Is there a simpler elegant way of acheiving a similar result; and
2) I want to narrow this down so that if the first a string contains
'O', 'D' or '0', these are ignored and left the same e.g. 'abcd1023o'
would be '@@@d#0##o'.
Thank you.
|