B
BobAtVandy
Below is a VBA function called from a formula in a cell in Excel.
In the line beginning "x =", the code correctly fetches the .Value of a
1-cell Range. Also, I can set other properties of that Range (like Font,
etc.). So, I'm pretty the cell is correctly qualified.
HOWEVER, the following line (ending with ="stuff") tries to set that same
..Value but fails with error 1004, "Application-defined or object-defined
error".
What is going on? How should I fix this? THANK YOU!!!!!
_____________________________________________
Function TestCopy()
Dim x As Variant
On Error GoTo ErrHandler
x = Worksheets("ETF Data").Range("H11").Value
Worksheets("ETF Data").Range("H11").Value = "stuff"
TestCopy = 1
Exit Function
ErrHandler:
MsgBox Err.Number & " : " & Err.Description
TestCopy = 0
End Function
__________________________________________
In the line beginning "x =", the code correctly fetches the .Value of a
1-cell Range. Also, I can set other properties of that Range (like Font,
etc.). So, I'm pretty the cell is correctly qualified.
HOWEVER, the following line (ending with ="stuff") tries to set that same
..Value but fails with error 1004, "Application-defined or object-defined
error".
What is going on? How should I fix this? THANK YOU!!!!!
_____________________________________________
Function TestCopy()
Dim x As Variant
On Error GoTo ErrHandler
x = Worksheets("ETF Data").Range("H11").Value
Worksheets("ETF Data").Range("H11").Value = "stuff"
TestCopy = 1
Exit Function
ErrHandler:
MsgBox Err.Number & " : " & Err.Description
TestCopy = 0
End Function
__________________________________________