can return .Value but not set it

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
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top