我有一个Excel表格,包含不同的单位值,比如“一百”和“千”。在
现在,我想把所有的“千”改为“一百”,这意味着原始单元格值将[cell]乘以10。在
我用VBA解决了这个问题,我想知道如何用python来解决这个问题?在
VBA like this :
Sub changecell()
Dim rng As Range
Dim i, t
Set rng = Sheet1.Range("b3:c5")
For Each i In rng
t = t + 1
If Not i Is Nothing Then
If Right(i, 4) = "sand" Then
rng(t) = Left(i, Len(i) - 8) * 10 & "hundred"
End If
End If
Next
End Sub
将excel工作表另存为csv文件,然后尝试以下操作:
编辑:
所以,你有成百上千的excel文件。。。不是所有的专栏。未测试代码:
^{pr2}$如果你需要用Python来做,使用pandas
但此VBA将在当前工作簿的所有工作表中执行替换:
相关问题 更多 >
编程相关推荐