Excel c# convert cell to percentage

后端 未结 4 1994
陌清茗
陌清茗 2021-01-19 04:17

I need to convert a cell with a double to a precentage. I used a macro in excel and it says:

Range(\"B5\").Select
Selection.Style = \"Percent\"
4条回答
  •  猫巷女王i
    2021-01-19 05:05

    I've found the anwser with help of JN Web

    Excel.Range procentRange = xlWorksheet.get_Range("A1","A1");    
    procentRange.NumberFormat = "###,##%";
    

    So first you need a range, then set the decimals and add "%" -> automatically a 100 time multiplication

提交回复
热议问题