0
When using vb 6.0 to make a cell, we cannot force the amount to be shown with 2 places after the decimal if the number does not have end in 1-9. For example 59.12 shows up correctly but if we try 59.10 we get 59.1 in the cell. Have tried many different formats and text outputs but with no success.
In answer to what we have tried below is a portion of the code we have been trying with the most remarked out:
StartForm:
ActiveWorkbook.Styles.Add(Name:="NelcoAmt").NumberFormat = "#.00"
'ActiveWorkbook.Styles("Number").NumberFormat = "######.00"
'ActiveWorkbook.Styles("Number").Application.FixedDecimalPlaces = 2
'ActiveWorkbook.Styles("Currency").Application.Caption = ""
'ActiveWorkbook.Styles("Currency").IncludePatterns = False
'ActiveWorkbook.Styles("Currency").Application. = ""
'ActiveWorkbook.Styles("Currency").Application.
'xlSheet.Cells(1, 34).NumberFormat = "@"
'xlSheet.Cells(2, 34).NumberFormat = "#.00"
'xlSheet.Cells(2, 34).Format = "#.00"
ActiveWorkbook.Styles("NelcoAmt").Application.FixedDecimalPlaces = 2
xlSheet.Cells(2, 34).Style = "NelcoAmt": '.NumberFormat = "#.00": 'Number
'For i% = 1 To ActiveWorkbook.Styles.Count
'Text$ = ActiveWorkbook.Styles(i%).Name
'xlSheet.Cells(i%, 1).Style = Text$
'xlSheet.Cells(i%, 1).Value = 59.4
'xlSheet.Cells(i%, 2).Value = Text$
'Next i%
Rem-----9/15/14---set header for variables
xlSheet.Cells(1, 1).Value = "UniqueFormKey"
xlSheet.Cells(1, 2).Value = "FormName"
xlSheet.Cells(1, 3).Value = "OR_EFIN"
xlSheet.Cells(1, 4).Value = "OR_Type"
Rem======================================start of test section
Dim NumAns As Double
'7/16/15
'NumAns = Format$(Format$(Val(Frm941Inp.Scr941(19)), "########.00"), "@@@@@@@@@@@")
txtOut = Format$(Format$(Val(Frm941Inp.Scr941(19)), "########.00"), "@@@@@@@@@@@")
'NumAns = FormatNumber((Val(Frm941Inp.Scr941(19))), 2)
NumAns = Val(Frm941Inp.Scr941(19))
If Val(Frm941Inp.Scr941(18)) = 0 Then txtOut = "0.00"
txtOut = Frm941Inp.Scr941(19)
'xlSheet.Cells(2, 34).NumberFormat = "@": ' = txtOut: '"########.00"]
'xlSheet.Cells(2, 34) = (FormatNumber(Val(Frm941Inp.Scr941(19)), 2), "text"): 'txtOut ', "########.00"): '5d 2 tax on add medi wage
'xlSheet.Cells(2, 34) = "'" & FormatNumber(Val(Frm941Inp.Scr941(19)), 2): 'txtOut ', "########.00"): '5d 2 tax on add medi wage
'txtOut = "'" & txtOut
xlSheet.Cells(2, 34).Style.NumberFormat = "#.00": 'Number
xlSheet.Cells(2, 34) = Format(NumAns, "#.00"): 'txtOut: 'Val(Frm941Inp.Scr941(19)): 'txtOut ', "########.00"): '5d 2 tax on add medi wage
'xlSheet.Cells(2, 34).Style.NumberFormat = "#.00": 'Number
'xlSheet.Cells(2, 34).NumberFormat = "#.00"
'xlSheet.Cells(2, 34).Value = Val(Frm941Inp.Scr941(19))
'xlSheet.Cells(2, 34).value = FormatNumber(Val(Frm941Inp.Scr941(19)), 2): '"#######.00")
'xlSheet.Cells(2, 34).Value = Format$(Format$(Val(Frm941Inp.Scr941(19)), "########.00"), "@@@@@@@@@@@")
'xlSheet.Cells(2, 34).Value = Val(Frm941Inp.Scr941(19)): '5d 2 tax on add medi wage
Rem===================================end of test section=================================================
Change the decimal places displayed for numbers – DavidPostill – 2015-07-20T16:37:33.777