Results 1 to 6 of 6

Thread: [RESOLVED] Excel numberformat !?

  1. #1

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Resolved [RESOLVED] Excel numberformat !?

    i am transferring data from a vb.net datagridview control to a new instance
    of excel (early binding)

    here i am creating a excel instance
    vb.net Code:
    1. Dim Exl_App As New Microsoft.Office.Interop.Excel.Application
    2.         Dim Exl_Wbook As Workbook
    3.         Exl_Wbook = Exl_App.Workbooks.Add
    4.         Dim Exl_Sheet As Worksheet
    5.         Dim ExL_Sheet2 As Worksheet
    here i am formatting the cells & transferring data
    vb.net Code:
    1. .Range("e1:e65000").Cells.NumberFormat = "Text"
    2.             .Range("g1:g65000").Cells.NumberFormat = "Text"
    3.             .Range("h1:h65000").Cells.NumberFormat = "Text"
    4.             .Range("i1:i65000").Cells.NumberFormat = "Text"

    but the out put in the excel file is (please refer to the attachment sheet2)

    the date type data out put is appearing like
    Code:
    T2011xt
    T2011xt
    T2011xt
    what is wrong i am doing here please
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  2. #2
    Hyperactive Member
    Join Date
    Oct 2010
    Location
    Indiana
    Posts
    457

    Re: Excel numberformat !?

    Quote Originally Posted by make me rain View Post
    but the out put in the excel file is (please refer to the attachment sheet2)
    What attachment?

    I assume you are trying to fomat the cells for text format, you want:

    "@"

    Instead of "Text"

  3. #3

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Re: Excel numberformat !?

    thank you every One
    your advise solved the issue.

    i have changed the code as fallows
    vb Code:
    1. .Range("e1:e65000").Cells.NumberFormat = "@"
    2.                                 .Range("i1:i65000").Cells.NumberFormat = "@"
    & it works
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  4. #4

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Re: [RESOLVED] Excel numberformat !?

    if you don't mind please post other types of cell number formats also please
    or else any link for that
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  5. #5
    Hyperactive Member
    Join Date
    Oct 2010
    Location
    Indiana
    Posts
    457

    Re: [RESOLVED] Excel numberformat !?

    If I find one I'll post it. For that I found it easier to just use the macro recorder and look at it's code.

  6. #6

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Re: [RESOLVED] Excel numberformat !?

    ok thanks
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

Posting Permissions

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



Click Here to Expand Forum to Full Width