+ Reply to Thread
Results 1 to 2 of 2

Convert Alpha characters back to numeric

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2007
    Posts
    16

    Convert Alpha characters back to numeric

    Have a piece of code that transforms leading character to numeric
    Now need a piece of code to revert the act so that the leading character (the alpha is converted back to numeric - numbers are left alone)
    ie (A=0, B=1, C=2, D=3, E=4, F=5, etc)

    Dim lngRowEnd As Long
    Columns("B").Insert
    lngRowEnd = Range("B65536").End(xlUp).Row
    Range("B1").Value = UserId

    Dim ce As Range, lastrow As Long
    lastrow = Range("A" & Rows.Count).End(xlUp).Row
    Columns("B:B").Select
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "UserID"
    Range("B2").Select

    For Each ce In Range("A2:A" & lastrow)
    ce.Offset(0, 1).NumberFormat = "@"
    ce.Offset(0, 1).Value = Chr(Asc(Left(ce.Value, 1)) - 17) & Mid(ce.Value, 2, Len(ce.Value))
    Next ce
    End Sub

    Any assistance greatly appreciated
    Thanks

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,933

    Re: Convert Alpha characters back to numeric

    Please Login or Register  to view this content.
    For the future:


    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here


    Manage Attachment Instructions
    To attach a Workbook
    (please do not post pictures of worksheets)
    Click Advanced (next to quick post),
    Scroll down until you see "Manage Attachments",
    Click that then select "add files" (top right corner).
    Click "Select Files" find your file, click "open" click "upload"
    Once the upload is completed the file name will appear below the input boxes in this window.
    Click "Done" at bottom right to close the Attachment Manager.
    Click "Submit Reply"
    Last edited by protonLeah; 08-14-2013 at 12:15 AM.
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Separating alpha, numeric and other characters
    By ldg in forum Excel General
    Replies: 10
    Last Post: 08-04-2015, 02:16 PM
  2. Separate Alpha and numeric characters
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-09-2013, 02:50 AM
  3. Can you ID a cell that has both Alpha AND Numeric characters?
    By Phil in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-18-2006, 04:35 PM
  4. Replies: 4
    Last Post: 02-06-2006, 03:05 AM
  5. [SOLVED] Columns are now numeric, not alpha. how to change back?
    By samriepe in forum Excel General
    Replies: 1
    Last Post: 06-09-2005, 11:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1