woodymcglathery
New Member
- Joined
- Jun 3, 2022
- Messages
- 15
- Office Version
- 365
- Platform
- Windows
Good morning,
Here is a portion of a macro I am working on. It would move the decimal point, for example (14.3 to .143), in order to format the number to %. It works fine however, until the whole number is 100. It will then ultimately change it to 10%. I know that if I were to edit the code below to "=REPLACE(SUBSTITUTE(E2,""."",""""),2,0,""."")+0" then it will enable the number to actually show 100%. Yet, we both know what that does to all numbers below 100. I am struggling with wording the If/Then or whatever other code I should insert. Hopefully I am making sense in what I need help for.
Range("D2").Select
ActiveCell.Value = "=REPLACE(SUBSTITUTE(E2,""."",""""),1,0,""."")+0"
Selection.Style = "Percent"
Selection.NumberFormat = "0.0%"
Here is a portion of a macro I am working on. It would move the decimal point, for example (14.3 to .143), in order to format the number to %. It works fine however, until the whole number is 100. It will then ultimately change it to 10%. I know that if I were to edit the code below to "=REPLACE(SUBSTITUTE(E2,""."",""""),2,0,""."")+0" then it will enable the number to actually show 100%. Yet, we both know what that does to all numbers below 100. I am struggling with wording the If/Then or whatever other code I should insert. Hopefully I am making sense in what I need help for.
Range("D2").Select
ActiveCell.Value = "=REPLACE(SUBSTITUTE(E2,""."",""""),1,0,""."")+0"
Selection.Style = "Percent"
Selection.NumberFormat = "0.0%"