View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Good code, need one more step

On Friday, August 10, 2012 9:02:33 PM UTC-5, Howard wrote:
Using excel 2010.



I got this code From Don Guillett Aug 9, 2012 and it works fine as far as the info I supplied him. I need one more step. The code converts the upper line

of letters (each letter is in separate cell in a named range, RangerTest, which is A1:Z1) to the lower line (each letter is in separate cell in a named range RtResult, which is A2:Z2).



FYI, the upper line is a coded substitute for OLIVER WENDELL HOLMES. The bottom line is a further code that recognizes a designated letter in the upper and produces a designated letter in the lower. In this case if there is a B in the upper it produces an O in the lower, hence the four O's in the lower, the rest are X's.



If I was to designate an E for the upper then there would be three O's in the lower and again the rest would be X's. The precoded words could be any number

of common words, like the following. INTERNATIONAL, KNOWLEDGEABLE, KANGAROO etc. There would be no blanks to contend with in these examples.



My problem arises when I try to take the bottom row and transfer it to a single cell while retaining the two "internal" blanks and excluding the blanks at the end, of which there are five (V2 thru Z2).



I have tried to add an additional "Case Is" in the code to make it produce a space in the "internal" blanks and ignore the blanks at the end, to no avail.

So I resorted to this clunky attempt but it does not bring the "internal" blanks to AE11. I get XOXXXXXXXXXOOXXOXXX instead.



Range("AE11").Value = Range("A2") & Range("B2") & Range("C2") & _

Range("D2") & Range("E2") & Range("F2") & _

Range("G2") & Range("H2") & Range("I2") & _

Range("J2") & Range("K2") & Range("L2") & _

Range("M2") & Range("N2") & Range("O2") & _

Range("P2") & Range("Q2") & Range("S2") & _

Range("T2") & Range("U2") & Range("V2") & _

Range("W2") & Range("X2") & Range("Y2") & Range("Z2")



As usual, it's probably pretty simple but it eludes me!



Thanks for any help,

Regards,


I don't understand. Send me your latest file and an explanation with EXAMPLES.