Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert to number format
i'm writing code in C# that uses a string array to insert a row of
fields into an excel sheet, at the end of the excel sheet i have a cell that is suppose to calculate the total of a column, it won't add the total because my numbers are being inserted as text, any easy fixes?? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert to number format
Hi
could you post the relevant part of your code that inserts the values in Excel -- Regards Frank Kabel Frankfurt, Germany Tommy wrote: i'm writing code in C# that uses a string array to insert a row of fields into an excel sheet, at the end of the excel sheet i have a cell that is suppose to calculate the total of a column, it won't add the total because my numbers are being inserted as text, any easy fixes?? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert to number format
well it's actually kind of tricky, i grab a bunch of pay roll
information and create an area for each cell in a row, then i add that row to an array of rows for the whole page and then i add it to excel, but theres a bunch of extra formatting i do for(int i = 0; i < pagearray.Length; i++) { //add 2 to the array to add values in after the headers int irow = i + 2; Excel.Range range = (Excel.Range)sheet.Cells.get_Range("A" + irow.ToString().Trim(),"P" + irow.ToString().Trim()); range.Value2 = pagearray[i]; //this is the relevant part of the code Frank Kabel wrote: Hi could you post the relevant part of your code that inserts the values in Excel -- Regards Frank Kabel Frankfurt, Germany Tommy wrote: i'm writing code in C# that uses a string array to insert a row of fields into an excel sheet, at the end of the excel sheet i have a cell that is suppose to calculate the total of a column, it won't add the total because my numbers are being inserted as text, any easy fixes?? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert to number format
Hi
if each element in your pagearray is a numeric value why not convert it to a number before inserting it into Excel (don't know the C# syntax for this). -- Regards Frank Kabel Frankfurt, Germany Tommy wrote: well it's actually kind of tricky, i grab a bunch of pay roll information and create an area for each cell in a row, then i add that row to an array of rows for the whole page and then i add it to excel,[i] but theres a bunch of extra formatting i do for(int i = 0; i < pagearray.Length; i++) { //add 2 to the array to add values in after the headers int irow = i + 2; Excel.Range range = (Excel.Range)sheet.Cells.get_Range("A" + irow.ToString().Trim(),"P" + irow.ToString().Trim()); range.Value2 = pagearray; //this is the relevant part of the code Frank Kabel wrote: Hi could you post the relevant part of your code that inserts the values in Excel -- Regards Frank Kabel Frankfurt, Germany Tommy wrote: i'm writing code in C# that uses a string array to insert a row of fields into an excel sheet, at the end of the excel sheet i have a cell that is suppose to calculate the total of a column, it won't add the total because my numbers are being inserted as text, any easy fixes?? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
convert to number format
Good point, as simple as that solution it escaped me, thanks a lot
Frank Kabel wrote: [i] Hi if each element in your pagearray is a numeric value why not convert it to a number before inserting it into Excel (don't know the C# syntax for this). -- Regards Frank Kabel Frankfurt, Germany Tommy wrote: well it's actually kind of tricky, i grab a bunch of pay roll information and create an area for each cell in a row, then i add that row to an array of rows for the whole page and then i add it to excel, but theres a bunch of extra formatting i do for(int i = 0; i < pagearray.Length; i++) { //add 2 to the array to add values in after the headers int irow = i + 2; Excel.Range range = (Excel.Range)sheet.Cells.get_Range("A" + irow.ToString().Trim(),"P" + irow.ToString().Trim()); range.Value2 = pagearray; //this is the relevant part of the code Frank Kabel wrote: Hi could you post the relevant part of your code that inserts the values in Excel -- Regards Frank Kabel Frankfurt, Germany Tommy wrote: i'm writing code in C# that uses a string array to insert a row of fields into an excel sheet, at the end of the excel sheet i have a cell that is suppose to calculate the total of a column, it won't add the total because my numbers are being inserted as text, any easy fixes?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
convert number to % using only custom number format challenge | Excel Discussion (Misc queries) | |||
Convert numbers from text format to number format | Excel Discussion (Misc queries) | |||
Convert [h]:mm sum total format to number format | Excel Worksheet Functions | |||
convert text-format number to number in excel 2000%3f | Excel Discussion (Misc queries) | |||
convert number format to time format | Excel Programming |