问题
I have an issue putting a formula in an excel cell. The formula contains a variable.
$batchname = Batch15c
$ws.Cells.Item(2,5).value() = "=VLOOKUP(RC[-1],[$batchname]Sheet1!$A$1:$D$300,2,FALSE)
I get the following error:-Exception setting "Value": "Exception from HRESULT: 0x800A03EC"
anybody got any ideas?
回答1:
I believe should be setting the Formula property instead of Value.
Try:
$ws.Cells.Item(2,5).Formula = "=VLOOKUP(RC[-1],[$batchname]Sheet1!$A$1:$D$300,2,FALSE)"
来源:https://stackoverflow.com/questions/22859584/putting-formula-in-cell-with-powershell