Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have have a varibale declared as a double, read a number into it from a file.
THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you look in the formulabar, do you see all 4 decimals?
If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Two decimal places are displayed in the formula bar. In the debugger the
varibale has four decimal places. -- Ray "Dave Peterson" wrote: If you look in the formulabar, do you see all 4 decimals? If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
AreaCount# = 1234.5678
? typename(areacount) Double ActiveCell.Value = Areacount# ? ActiveCell.Value 1234.5678 ? activeCell.Text 1234.568 -- Regards, Tom Ogilvy "Halray" wrote in message ... Two decimal places are displayed in the formula bar. In the debugger the varibale has four decimal places. -- Ray "Dave Peterson" wrote: If you look in the formulabar, do you see all 4 decimals? If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I used your version of the variable declaration with the pound symbol on the
end instead of the DIM statement and my code now works. Do you know why? Thanks for your help on this - really do appreciate it. -- Ray "Tom Ogilvy" wrote: AreaCount# = 1234.5678 ? typename(areacount) Double ActiveCell.Value = Areacount# ? ActiveCell.Value 1234.5678 ? activeCell.Text 1234.568 -- Regards, Tom Ogilvy "Halray" wrote in message ... Two decimal places are displayed in the formula bar. In the debugger the varibale has four decimal places. -- Ray "Dave Peterson" wrote: If you look in the formulabar, do you see all 4 decimals? If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hmmm. What are the two numbers?
Then we can try some simple tests. Halray wrote: Two decimal places are displayed in the formula bar. In the debugger the varibale has four decimal places. -- Ray "Dave Peterson" wrote: If you look in the formulabar, do you see all 4 decimals? If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One more guess.
If the cell is formatted to show 2 decimals and you have Tools|Options|calculation tab|precision as displayed checked, it could cause what you describe. With ActiveCell .NumberFormat = "0.00" .Value = "1234.1234" MsgBox .Value End With Halray wrote: Two decimal places are displayed in the formula bar. In the debugger the varibale has four decimal places. -- Ray "Dave Peterson" wrote: If you look in the formulabar, do you see all 4 decimals? If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave,
I've been away, but now that I check what you say I do not have that option checked. Any more ideas? -- Ray "Dave Peterson" wrote: One more guess. If the cell is formatted to show 2 decimals and you have Tools|Options|calculation tab|precision as displayed checked, it could cause what you describe. With ActiveCell .NumberFormat = "0.00" .Value = "1234.1234" MsgBox .Value End With Halray wrote: Two decimal places are displayed in the formula bar. In the debugger the varibale has four decimal places. -- Ray "Dave Peterson" wrote: If you look in the formulabar, do you see all 4 decimals? If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson -- Dave Peterson |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
None from me.
But you never said what the numbers were! Halray wrote: Dave, I've been away, but now that I check what you say I do not have that option checked. Any more ideas? -- Ray "Dave Peterson" wrote: One more guess. If the cell is formatted to show 2 decimals and you have Tools|Options|calculation tab|precision as displayed checked, it could cause what you describe. With ActiveCell .NumberFormat = "0.00" .Value = "1234.1234" MsgBox .Value End With Halray wrote: Two decimal places are displayed in the formula bar. In the debugger the varibale has four decimal places. -- Ray "Dave Peterson" wrote: If you look in the formulabar, do you see all 4 decimals? If yes, try widening the column. If no, what value do you see in the debugger and what value do you see in the formulabar? Halray wrote: Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray -- Dave Peterson -- Dave Peterson -- Dave Peterson |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Halray,
I think that if the cell your setting already has a format it might cause what you're seeing, so try setting the format: With ActiveWorkbook.Worksheets("Dump Area").Cells(RowNumber, 2) .Value = AreaCounts .NumberFormat = "#.0000" End With hth, Doug "Halray" wrote in message ... Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry that format has no affect either before or after the write.
-- Ray "Doug Glancy" wrote: Halray, I think that if the cell your setting already has a format it might cause what you're seeing, so try setting the format: With ActiveWorkbook.Worksheets("Dump Area").Cells(RowNumber, 2) .Value = AreaCounts .NumberFormat = "#.0000" End With hth, Doug "Halray" wrote in message ... Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Based on your answer to Dave's question, I can now see that it wouldn't.
Hopefully, he'll have an answer. Doug "Halray" wrote in message ... Sorry that format has no affect either before or after the write. -- Ray "Doug Glancy" wrote: Halray, I think that if the cell your setting already has a format it might cause what you're seeing, so try setting the format: With ActiveWorkbook.Worksheets("Dump Area").Cells(RowNumber, 2) .Value = AreaCounts .NumberFormat = "#.0000" End With hth, Doug "Halray" wrote in message ... Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for trying to help - I'm still looking for an answer.
Thanks again!!! -- Ray "Doug Glancy" wrote: Based on your answer to Dave's question, I can now see that it wouldn't. Hopefully, he'll have an answer. Doug "Halray" wrote in message ... Sorry that format has no affect either before or after the write. -- Ray "Doug Glancy" wrote: Halray, I think that if the cell your setting already has a format it might cause what you're seeing, so try setting the format: With ActiveWorkbook.Worksheets("Dump Area").Cells(RowNumber, 2) .Value = AreaCounts .NumberFormat = "#.0000" End With hth, Doug "Halray" wrote in message ... Have have a varibale declared as a double, read a number into it from a file. THe variable is indicated with four decimal places when viewed in the debugger. When I write the variable out to Excel using the following the number gets truncated to two decimal places: With ActiveWorkbook.Worksheets("Dump Area") .Cells(RowNumber, 2) = AreaCounts Anyone have any suggestions to fix this problem? Thanks ! -- Ray |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to write 1234567890123456789 into a cell with number format | Excel Discussion (Misc queries) | |||
number entered in cell loses trailing zeros in formula bar | Excel Discussion (Misc queries) | |||
variable number format in cell | Excel Discussion (Misc queries) | |||
webquery loses format of leading zero and to scientific | Excel Programming | |||
Passing Number Format to a Variable | Excel Programming |