Increment Letter in a String
Hi
Whilst you have been given answers to the question you posed, if the object
is to make up a range value to extract data from a cell e.g.
Range("AA1").value, you might find it easier to use Cells()
x= x+1 (where x was 26)
Cells(1,x).value would give the same result.
--
Regards
Roger Govier
"manish" wrote in message
oups.com...
Hi,
I am sorry if it is repost. I am relatively new to macros. I want to
increment letter in a string present in a cell. If the cell value is
"A" I want to make it "B" etc. However, if the cell value is "Z", I
want to change it to "AA". If it is "AA", it should change to "AB" and
so on. I wrote following code for increment letters:
NextIndex = Asc(char) + 1
CellOfInterest.Value = Chr(NextIndex)
Above code changes A to B, B to C and so on. However, it does not
change Z to AA. It just gives me next ASCII value ([). Is there any
way to make this happen?
Any help would be greatly appreciated!
|