+ Reply to Thread
Results 1 to 4 of 4

Macro to change hexadecimal values to normal

Hybrid View

  1. #1
    Registered User
    Join Date
    03-09-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    85

    Macro to change hexadecimal values to normal

    Hi,

    I have data in excel sheet but some of the data in hexadecimal format.I need a macro to change the hexadecimal values to ascii values.

    thx...

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro to change hexadecimal values to normal

    support.microsoft.com/kb/161304

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Macro to change hexadecimal values to normal

    Try:
    Sub foo()
    Dim c As Range
    On Error Resume Next
    For Each c In Selection
        c.Value = WorksheetFunction.Hex2Dec(c.Text)
    Next c
    End Sub
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Re: Macro to change hexadecimal values to normal


    Hi,

    just notice worksheet function Hex2Dec is limited to 10 characters.
    If there is more characters to convert, up to 15, better is to use full VBA convertion :

    Function Hexa2Dec$(Rg As Range)
             Dim Cel As Range
        For Each Cel In Rg
            Select Case Len(Cel.Value)
                   Case Is > 15: Exit Function
                   Case Is > 0:  V = V + CDec("&h" & Cel.Value)
            End Select
        Next
             Hexa2Dec = Format$(V, "#,##0")
    End Function
    If more than a cell in the range, this function operates a sum of the hexa cells …
    Last edited by Marc L; 04-11-2014 at 12:32 PM.

+ 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. Excel 2007 : Change number formatting for style Normal
    By mckay.candice in forum Excel General
    Replies: 1
    Last Post: 02-24-2011, 06:49 PM
  2. How do I change text from all caps to normal type?
    By Karol in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-20-2006, 11:55 AM
  3. [SOLVED] Problem opening csv files with hexadecimal values
    By Eyal Shwartzman in forum Excel General
    Replies: 4
    Last Post: 01-19-2006, 01:35 PM
  4. How do I change hexadecimal number to binary in excel
    By Aimran in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-09-2005, 06:30 PM
  5. [SOLVED] I've got some problems in converting Hexadecimal values to ASCII
    By vleong01@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2005, 07: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