伙计们,我正在努力让这段代码从excel表中运行为Macro(名为" Kalender"):
Public Function dcTest(s As String) As String
Dim ws As Worksheet
On Error GoTo dcTestExit
Err.Clear
Set ws = ActiveSheet
' Set ws = Worksheets("Kalender") '... same error (and yes, the sheet exists!)
' ws.Cells(2, 2).FormulaR1C1 = s
ws.Cells(2, 2).Value = s
dcTestExit:
Set E = Err
End Function
尝试写入Value
或FormulaR1C2
属性后发生错误。该函数被称为"用户定义"从=dcTest("whatever")
等Excel工作表中获取功能。
你能指出我正确的方向吗? RT(F)M欢迎,只要有详细信息......
干杯, ChrisF