Vba Numberformat muliple condtions to format cell value

元气小坏坏 提交于 2021-01-29 07:11:50

问题


Dear all i want to format my cell based on the Cell value. There are 3 possible Conditions:

  1. Cell is larger than 0.05 -> the Value should stay the same but be fromated to 0.0
  2. Cell is smaller than 0.05 -> the Value should be replaced with a String "a.C."
  3. Cell is Zero -> the Value should be replaced with a Dash"

I found thisSolution for the dashes and could combine it with the number formating

.NumberFormat = "0.0;[=0]---"

This works. but if i add an additonal argument the vba code breaks.

.NumberFormat = "0.0;[=0]---;[<0.05]a.C."

Does not work. Would you mind telling me what i am doing wrong?

Thank you in advance


回答1:


Edit:

FOr what ever reason this Order seems to work:

.NumberFormat = "[=0]---;[<0.05] ""a.C."";0.0 "



来源:https://stackoverflow.com/questions/65129793/vba-numberformat-muliple-condtions-to-format-cell-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!