I'm a VBA newbie, but have successfully created a handful of useful Excel Functions. The one I'm working on right now, which seems like it should be simple, is eluding me. I think I'm misunderstanding the syntax, and need some guidance.
Consider the following screen capture; I am attempting to create the function in Column E, which is simply the VALUE from D$n.
So far, this is as far as I've gotten:
Function PASTVALUE(q As String)
q.PasteSpecial Paste:=xlPasteValues
End Function
which, if I understand properly, is reading the input value (in my case, the contents of cell D$n
) as a String, then pasting it using PasteValues
.
Do I need to somehow copy it before I paste it? I thought that the q As String
parameter was what brought it into the function.
But then if I'm not copying, is it trying to paste
from an empty clipboard...in which case I have no idea what I should be using to accomplish this.
Help!