- Function Auto_compute(myrange) As Variant
- Dim temp As Variant
- Dim i As Integer, j As Integer, s As Integer
- temp = myrange
- If IsArray(temp) Then
- Dim arr As Variant
- For i = 1 To UBound(temp, 1)
- For j = 1 To UBound(temp, 2)
- For s = 1 To Len(temp(i, j))
- If (InStr(temp(i, j), "[") = 0) Then
- Exit For
- Else
- temp(i, j) = Replace(temp(i, j), Mid(temp(i, j), InStr(temp(i, j), "["), InStr(temp(i, j), "]") - InStr(temp(i, j), "[") + 1), "")
-
- End If
- Next s
- temp(i, j) = Application.Evaluate(temp(i, j))
- Next j
- Next i
- Else
- For s = 1 To Len(temp)
- If (InStr(temp, "[") = 0) Then
- Exit For
- Else
- temp = Replace(temp, Mid(temp, InStr(temp, "["), InStr(temp, "]") - InStr(temp, "[") + 1), "")
-
- End If
- Next s
- temp = Application.Evaluate(temp)
- End If
- Auto_compute = temp
- End Function
复制代码
|