Next Alphabetic Character

  • Hi


    How to write VBA code to findout the
    'next letter' for a alphabetic character


    its working in spreadsheet,
    this is the formula


    Code
    =CHAR(CODE("A")+1)


    how to write the same formula in VBA code?



    Thanks in advance
    Udhay

  • Re: Find Out Next Chart


    Hi udhay28!


    Maybe something like this:


    Mac

  • Re: Find Out Next Chart


    To generate the new character in VBA, look at this code. It increments the first character from each non-numeric string in column A and wites it to the adjacent column B cell.

    Code
    Sub IncrementAlpha()
    Dim c As Range
    For Each c In Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
        If Not IsNumeric(Left(c, 1)) Then c.Offset(0, 1) = Chr(Asc(c) + 1)
    Next c
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!