locked
how to make excel compartible with all format & Location using c# RRS feed

  • General discussion

  • in my code when I am exporting data to excel in English(united state) format data populating correctly but when format changing number coming as text or 555.440.333.222 pattern, plz tell me where I need to do changes  
    • Moved by CoolDadTx Tuesday, January 19, 2016 6:07 PM Office related
    Tuesday, January 19, 2016 4:32 AM

All replies

  • Are you exporting to .xlsx or to .csv file?

    Tuesday, January 19, 2016 6:47 AM
  • >>>in my code when I am exporting data to excel in English(united state) format data populating correctly but when format changing number coming as text or 555.440.333.222 pattern, plz tell me where I need to do changes 

    According to your description, I suggest that you could use VBA code to change number coming as text into 555.440.333.222 pattern, refer to below code:

    Sub Demo()
      Range("A1").NumberFormat = "@"
      Dim val As String
      val = Range("A1")
      Dim valLen As Integer
      valLen = Len(val) / 3
      Dim result As String
      Dim i As Integer
      i = 0
        Do
          result = result & Mid(val, 1 + i * 3, 3) & "."
          i = i + 1
        Loop While i < valLen
       Range("A1") = Mid(result, 1, Len(result) - 1)
    End Sub


    Saturday, January 23, 2016 6:39 AM