Jul 19 2022 02:08 AM
Hello, when I write in a cell a number (for example 40), I would like to, not see the number, but 24,84 for example.
And this for some other numbers too if this is possible. I don't know where I have to do this so I can get this result. All the numbers that have to change are in E so the number can also be in D, but can only change in E.
Thank you so much for answering.
Have a nice day!
Jul 19 2022 02:29 AM - edited Jul 19 2022 02:30 AM
Not clear what do you want to do? Can you show some sample data and desired output?
Jul 19 2022 02:39 AM
@Harun24HR Of course, thank you for your answer!
Jul 19 2022 03:56 AM
You cannot do this with a formula, for a formula cannot refer to the cell itself. You need VBA code in the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Not Intersect(Range("E2:E1000"), Target) Is Nothing Then
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each rng In Intersect(Range("E2:E1000"), Target)
Select Case rng.Value
Case 40
rng.Value = 24.84 ' VBA uses decimal point, not comma
Case 401
rng.Value = 27.32
Case 25
rng.Value = 31.15
' add other cases as needed
End Select
Next rng
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
See the attached version of your workbook. It is now a macro-enabled workbook, so you will have to allow macros. Right-click the sheet tab and select 'View Code' from the context menu to inspect and edit the code.