Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default zero's in excel cell getting rounded off



i am using a VB routine to parse the text file and copy the data to an
excel sheet.and if in text file the data is 000000000 it is getting
rounded to just one 0 and i need all of them in excel, any thoughts?

Private Sub cmdgo_Click()
Set sap_xlapp = CreateObject("Excel.Application") 'New
Excel.Application
sap_xlapp.DisplayAlerts = False
sap_xlapp.Workbooks.Open App.Path & "\SAP_Data.xls", , False, , , ,
True, , , True, False 'the excel file is now opened
sap_xlapp.Worksheets(1).Activate ' the excel worksheet is now active
for reading
Set sap_xlws = sap_xlapp.ActiveSheet
l_int_srow = 1

sap_xlws.Cells(l_int_srow, 1) = "Permanent Number"
sap_xlws.Cells(l_int_srow, 2) = "Name"
l_int_srow = l_int_srow + 1
cmdgo.Enabled = False
Call Main

'Transformation completed so clean up resources
cmdgo.Enabled = True
Set sap_xlws = Nothing
sap_xlapp.ActiveWorkbook.Save
sap_xlapp.ActiveWorkbook.Close
sap_xlapp.Quit
Set sap_xlapp = Nothing

End Sub

as seen in the code the numberic value is getting off which is stored in
variable of string type

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default zero's in excel cell getting rounded off

There is nothing in the code you show that would do this. There is nothing
in the code you show that would be considered as parsing a text file.

--
Regards,
Tom Ogilvy

"Nasreen naqvi" wrote in message
...


i am using a VB routine to parse the text file and copy the data to an
excel sheet.and if in text file the data is 000000000 it is getting
rounded to just one 0 and i need all of them in excel, any thoughts?

Private Sub cmdgo_Click()
Set sap_xlapp = CreateObject("Excel.Application") 'New
Excel.Application
sap_xlapp.DisplayAlerts = False
sap_xlapp.Workbooks.Open App.Path & "\SAP_Data.xls", , False, , , ,
True, , , True, False 'the excel file is now opened
sap_xlapp.Worksheets(1).Activate ' the excel worksheet is now active
for reading
Set sap_xlws = sap_xlapp.ActiveSheet
l_int_srow = 1

sap_xlws.Cells(l_int_srow, 1) = "Permanent Number"
sap_xlws.Cells(l_int_srow, 2) = "Name"
l_int_srow = l_int_srow + 1
cmdgo.Enabled = False
Call Main

'Transformation completed so clean up resources
cmdgo.Enabled = True
Set sap_xlws = Nothing
sap_xlapp.ActiveWorkbook.Save
sap_xlapp.ActiveWorkbook.Close
sap_xlapp.Quit
Set sap_xlapp = Nothing

End Sub

as seen in the code the numberic value is getting off which is stored in
variable of string type

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default zero's in excel cell getting rounded off

Reset the number format for the required range to display

"Range".NumberFormat = "000000"

"Nasreen naqvi" wrote:



i am using a VB routine to parse the text file and copy the data to an
excel sheet.and if in text file the data is 000000000 it is getting
rounded to just one 0 and i need all of them in excel, any thoughts?

Private Sub cmdgo_Click()
Set sap_xlapp = CreateObject("Excel.Application") 'New
Excel.Application
sap_xlapp.DisplayAlerts = False
sap_xlapp.Workbooks.Open App.Path & "\SAP_Data.xls", , False, , , ,
True, , , True, False 'the excel file is now opened
sap_xlapp.Worksheets(1).Activate ' the excel worksheet is now active
for reading
Set sap_xlws = sap_xlapp.ActiveSheet
l_int_srow = 1

sap_xlws.Cells(l_int_srow, 1) = "Permanent Number"
sap_xlws.Cells(l_int_srow, 2) = "Name"
l_int_srow = l_int_srow + 1
cmdgo.Enabled = False
Call Main

'Transformation completed so clean up resources
cmdgo.Enabled = True
Set sap_xlws = Nothing
sap_xlapp.ActiveWorkbook.Save
sap_xlapp.ActiveWorkbook.Close
sap_xlapp.Quit
Set sap_xlapp = Nothing

End Sub

as seen in the code the numberic value is getting off which is stored in
variable of string type

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding zero's to Time formated cell Browner Excel Worksheet Functions 3 June 20th 06 07:02 PM
How do I keep 2 zero's in front of s/n in a cell klieske Excel Discussion (Misc queries) 6 April 26th 06 08:38 PM
Need formula to have date in cell B2 rounded to first of next mont RamseyR Excel Worksheet Functions 3 October 20th 05 08:28 AM
adding zero's to a text cell Jennifer Excel Worksheet Functions 2 August 13th 05 02:54 AM
Cell value rounded to the tenth! Kim-Anh Tran[_14_] Excel Programming 1 May 13th 04 08:56 AM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"