Results 1 to 3 of 3

Thread: Info: different Value !

  1. #1
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    13

    Info: different Value !

    Hi,

    We are using the following code, run regularly in Excel 2003
    The list includes only positive numbers: 12.625

    While Excel 2007 does not show the same values ​​...

    Any idea? How do I fix these codes?

    Any advice is appreciated

    Code:
    '--- Dati -50
    Sub Formula()
        Dim x As Long
        Dim Decurta As Double
        Decurta = Sheets("Foglio1").Range("J1").Value
        For x = 2 To Range("A" & Rows.Count).End(xlUp).Row
            Cells(x, 8).Value = Cells(x, 3) - Decurta
        Next
    End Sub
    
    '--------- 2 Dec.
    Sub Decimali()
        Dim x   As String
    
    '---Cerco i decimali nella colonna F e copio i valori nella colonna I
        With Range("F2:F" & Range("F" & Rows.Count).End(xlUp).Row)
            x = .Address
            .Offset(, 3) = Evaluate("if(isnumber(" & x & "),round((" & "int(" & x & "* 100" & ")),0)/100," & x & ")")
        End With
    
    End Sub
    It could be "round(" if the text language is not the same?
    Last edited by PcMax; 04-16-2012 at 03:22 AM. Reason: updating

  2. #2
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    13
    Can you show us some examples of values that are not the same in XL2003 and Xl2007 with that code?

  3. #3
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    13
    Hi,

    Only now I have understood what were the causes of differences in processing between 2003 and Excel 2007
    When retrieving data from the web (an external procedure to excel) I get some values ​​in a column in string format.
    The whole column always contains positive values ​​such: 34,12

    I checked with a macro ZTEST you can fix it.

    Code:
    Sub Enter_Values()
        Dim x   As Variant
        Dim Xcell As Variant
        For Each Xcell In Range("F2:F25000") ' Selection
            Xcell.Value = CDec(Xcell.Value)
        Next Xcell
    End Sub
    
    Sub Decimali()
        Dim x   As String
        With Range("F2:F" & Range("F" & Rows.Count).End(xlUp).Row)
            x = .Address
            .Offset(, 3) = Evaluate("if(isnumber(" & x & "),round((" & "int(" & x & "* 100" & ")),0)/100," & x & ")")
        End With
    End Sub
    
    Sub ZTest()
        Call Enter_Values
        Call Decimali
    End Sub
    Waiting for suggestions for a better solution!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •