我尝试更改其他工作簿的单元格“ A6”,所以我编写了这段代码,但是它不起作用,我不知道为什么,我尝试了不同的代码,但是仍然不起作用,你知道吗为什么?
谢谢
Sub test()
Dim wbSource As Workbook
Dim shCurrency As Worksheet
Set wbSource = Workbooks("BP19.xls")
Set shCurrency = wbSource.Sheets("KPI")
wbSource.shCurrency.Range("A6") = "LC"
End Sub
但是当我把它放进去
Workbooks("BP19.xls").Worksheets("KPI").Range("A6") = "EUR"
答案 0 :(得分:1)
摆脱wbSource
前面的shCurrency
。 shCurrency
已引用Sheet
中的wbSource
。
Sub test()
Dim wbSource As Workbook
Dim shCurrency As Worksheet
Set wbSource = Workbooks("BP19.xls")
Set shCurrency = wbSource.Sheets("KPI")
shCurrency.Range("A6") = "LC"
End Sub