我在VBA中创建了一个简单的函数。我想根据用户的决定使输出变粗。但是,我不知道如何调用键入函数的单元格地址。不知怎的,application.caller.address不起作用。
以下是一段代码:
Public Function Reverse(text As String, bold As Boolean) As Variant
Dim reversedtext As String
Dim charnumber As Integer
reversedtext = StrReverse(text)
charnumber = Len(text)
Dim CallerAddr As Variant
CallerAddr = Application.Caller.Address
If bold = True Then
Range(CallerAddr).Font.bold = True
End If
Reverse = Array(reversedtext, charnumber)
End Function
非常感谢。