assign value to range in VBA function
< except if you are calling the function from a cell
A very useful addition! I tend to forget that and always assume functions
are called from a worksheet.
Thanks!
--
Kind regards,
Niek Otten
"sebastienm" wrote in message
...
Yes and your code should work the same way.... except if you are calling
the
function from a cell ie you are using the function as a worksheet function
(in C4: =MyFunc(...) ) in which case changing the sheet/cells through the
function is not allowed.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
"excelman" wrote:
This code works in a VBA Sub but not in a VBA function
Dim wsPurchase As Worksheet
Set wsPurchase = Worksheets("Purchase")
Dim rCriteria As Range
Set rCriteria = wsPurchase.Range("A1:A2")
rCriteria.Offset(1, 0).Value = sSet
Is there a way to change a worksheet cell from within a VBA function?
|