Greetings,
Probably not as slick as it could be, but maybe use a RegExp.
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> callit()<br> Sheet3.Range("A1").Value = SwapLetters(Sheet3.Range("A1"))<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br> <br><SPAN style="color:#00007F">Function</SPAN> SwapLetters(r <SPAN style="color:#00007F">As</SPAN> Range) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> REX <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> s <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> REX = CreateObject("VBScript.RegExp")<br> <SPAN style="color:#00007F">With</SPAN> REX<br> .Global = <SPAN style="color:#00007F">True</SPAN><br> .Pattern = "A"<br> s = .Replace(r.Value, Chr(162))<br> .Pattern = "C"<br> s = .Replace(s, Chr(163))<br> .Pattern = "G"<br> s = .Replace(s, Chr(164))<br> .Pattern = "T"<br> s = .Replace(s, Chr(165))<br> <br> .Pattern = Chr(162)<br> s = .Replace(s, "T")<br> .Pattern = Chr(163)<br> s = .Replace(s, "G")<br> .Pattern = Chr(164)<br> s = .Replace(s, "C")<br> .Pattern = Chr(165)<br> s = .Replace(s, "A")<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <br> SwapLetters = s<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>
If I was going thru oodles of cells, I might create the object in the calling sub.
Hope that helps,
Mark