我尽力做到这一点,但我是VBA的新手,而且我无处可去。我知道礼仪似乎是发布你正在尝试使用的内容,但它是从SE中获取的一堆无用的片段。
我把它全部废弃,然后以为我再次开始之前请求帮助。
任何建议 - 以代码或资源指示的形式 - 将非常感激。
我有一个包含文本单元格和%单元格的工作表。我只需要一个宏来扫描并将所有%年龄转换为实数,这基本上涉及乘以100然后更改单元格格式。
谢谢大家,
萨姆
答案 0 :(得分:1)
试试这个小宏:
Sub FixFormat()
For Each r In ActiveSheet.UsedRange
If InStr(1, r.NumberFormat, "%") > 0 Then
v = r.Value
r.Clear
r.Value = 100 * v
r.NumberFormat = "General"
End If
Next r
End Sub
答案 1 :(得分:0)
Sub convertToNumber()
For Counter = 1 To 20
Set curCell = Worksheets("Sheet1").Cells(Counter, 1)
curCell.NumberFormat = "#,##0.00"
Next Counter
End Sub
我希望有帮助