|
-
Apr 25th, 2011, 09:45 AM
#1
Thread Starter
PowerPoster
[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:
Dim Exl_App As New Microsoft.Office.Interop.Excel.Application
Dim Exl_Wbook As Workbook
Exl_Wbook = Exl_App.Workbooks.Add
Dim Exl_Sheet As Worksheet
Dim ExL_Sheet2 As Worksheet
here i am formatting the cells & transferring data
vb.net Code:
.Range("e1:e65000").Cells.NumberFormat = "Text"
.Range("g1:g65000").Cells.NumberFormat = "Text"
.Range("h1:h65000").Cells.NumberFormat = "Text"
.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
-
Apr 25th, 2011, 02:11 PM
#2
Hyperactive Member
Re: Excel numberformat !?
 Originally Posted by make me rain
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"
-
Apr 25th, 2011, 09:23 PM
#3
Thread Starter
PowerPoster
Re: Excel numberformat !?
thank you every One
your advise solved the issue.
i have changed the code as fallows
vb Code:
.Range("e1:e65000").Cells.NumberFormat = "@" .Range("i1:i65000").Cells.NumberFormat = "@"
& it works
-
Apr 25th, 2011, 09:25 PM
#4
Thread Starter
PowerPoster
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
-
Apr 25th, 2011, 09:30 PM
#5
Hyperactive Member
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.
-
Apr 25th, 2011, 09:31 PM
#6
Thread Starter
PowerPoster
Re: [RESOLVED] Excel numberformat !?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|