Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Dulceata_ta36 21 ani
Femeie
21 ani
Galati
cauta Barbat
28 - 53 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Convert Static Numbers to Formulas (eg 1000 to =1000) Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 795
Non-VBA - Use a Helper Column (eg. one-time fix)

Suppose your numbers are in Column A (A1:A100).
In Column B, enter the formula:
="=" & A1
Drag down to apply to all rows.
Copy the results in Column B.
Paste them back into Column A using Paste Special → Values.
Press Ctrl + H, find = and replace it with =, forcing Excel to interpret them as formulas.

VBA


Sub ConvertNumbersToFormulas()
    Dim cell As Range
    Dim decimalSep As String, thousandsSep As String
    Dim correctedValue As String
   
    ' Get the system's decimal and thousands separators
    decimalSep = Application.International(xlDecimalSeparator) ' Usually ","
    thousandsSep = Application.International(xlThousandsSeparator) ' Usually "."

    For Each cell In Selection
        If IsNumeric(cell.Value) Then
            correctedValue = CStr(cell.Value) ' Convert to string to process replacements
           
            ' First, remove thousands separator (e.g., "1.000,50" -> "1000,50")
            If thousandsSep <> "" Then
                correctedValue = Replace(correctedValue, thousandsSep, "")
            End If
           
            ' Then, replace the decimal separator (e.g., "1000,50" -> "1000.50")
            If decimalSep <> "." Then
                correctedValue = Replace(correctedValue, decimalSep, ".")
            End If
           
            ' Assign as a formula
            cell.Formula = "=" & correctedValue
        End If
    Next cell
End Sub


pus acum 4 saptamani
   
Pagini: 1  

Mergi la