can't detect arabic text on MS excel VBA RRS feed

  • Question

  • Hi,

    I can anybody help me..

    I am struggling to detect arabic text from cell..

    I am writing a program to detect the arabic numbers from alphanumeric arabic text.

    unfortunately i am unable to get it.

    if the cell is consist of only arabic numbers then i can get it, but if the value in cell is alphanumeric

    then it is consider whole as char.

    Program is :


    Sub ReverseText()

    Dim Rng As Range
    Dim WorkRng As Range
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)

    For Each Rng In WorkRng
            xValue = Rng.Value
            xValue = "       " & xValue
            xLen = VBA.Len(xValue)
            xOut = ""
            yOut = ""

                'Trying to reverse the arabic char
                For i = 1 To xLen
                getchar = VBA.Right(xValue, 1)

                    'Checking if String contain numbers or not
                    If IsNumeric(getchar) Then
                    xValue = VBA.Left(xValue, xLen - i)
                    yOut = getchar & yOut

                    'If not numers then check for decimal point
                        If getchar = "." Then
                        xValue = VBA.Left(xValue, xLen - i)
                        yOut = getchar & yOut
                        'xOut = xOut & yOut
                        getchar = ""

                        'If not numbers then check for char other than numbers
                            xValue = VBA.Left(xValue, xLen - i)
                            xOut = xOut & yOut
                            xOut = xOut & getchar
                            yOut = ""
                        End If
                    End If


                Rng.Value = xOut
    End Sub


    Value in cell is : ARABIAN COLA CAN 355ML X 20

    after running program output should be : 20 X LM355 NAC ALOC NAIBARA

    this is in english, and working properly.

    now in arabic 

    value in cell is :

                      ٦*ﻣ٣٥٥ﻛﺎﻣ ﻲﺳﺑﺑ

    and output by this program :

    ﺑﺑﺳﻲ ﻣﺎﻛ٥٥٣ﻣ*٦                         

    alphabets are reversing properly, but numbers also, which should not be.

    i need the output same like english text one. but program is not detecting arabic number.

    I am using excel2011 mac.

    i tried in windows 7 also but there also same problem.

    can anybody help me out. i need help urgently..



    Sunday, July 26, 2015 6:29 AM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    George Zhao
    TechNet Community Support

    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.

    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    Monday, July 27, 2015 2:45 AM
  • Hi SneHal,

    This forum is for Developer discussions and questions involving Microsoft Excel like Excel automation or Excel Object Model, your issue is more related with detect Arabic number with VBA, I will move this thread to the more related forum.


    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 28, 2015 8:24 AM