Excel 2007 – 有条件的货币格式

是否可以根据单元格的值设置列的货币(£/€/ $)?

例如,如果我确定在工作簿中使用的地址是美国,则工作簿货币将设置为美元。

这将节省多个不同货币的电子表格的时间。

在此先感谢任何可以帮助的人。

诺埃尔

任何可能感兴趣的人都会提出以下build议,如果有更好的方法来解决这个问题,请告诉我们

' ' Set the Currency of the worksheet ' Public Sub setCurrency() Dim eurFormat As String Dim strFormat As String ' Euro currency format eurFormat = "[$€-1809]#,##0.00" ' Sterling currency format strFormat = "[$£-809]#,##0.00" If Worksheets("ws-with-cell-value").Cells(1, 2).Value = "GBP £" Then Worksheets("ws1").Columns("C:C").NumberFormat = strFormat Worksheets("ws2").Columns("I:J").NumberFormat = strFormat End If If Worksheets("ws-with-cell-value").Cells(1, 2).Value = "EUR €" Then Worksheets("w1").Columns("C:C").NumberFormat = eurFormat Worksheets("ws2").Columns("I:J").NumberFormat = eurFormat End If End Sub 

然后在workbook_activate()和Sub Worksheet_Change上调用该子例程以获得“ws-with-cell-value”

希望这可以帮助那里的人