ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   passing cell address to sub - write that cell (https://www.excelbanter.com/excel-programming/449777-passing-cell-address-sub-write-cell.html)

[email protected]

passing cell address to sub - write that cell
 
What am I doing wrong?

function xx (x as range) as whatever
x.value2 = "test"

or
x.text = "test"


compiles - I can see the object - but bombs. ????


Entered function in cell as xx(B5)

Claus Busch

passing cell address to sub - write that cell
 
Hi,

Am Tue, 4 Feb 2014 20:18:30 -0800 (PST) schrieb :

function xx (x as range) as whatever
x.value2 = "test"


try:
Function xx(x As Range) As String
xx = x.Value
End Function


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

joeu2004[_2_]

passing cell address to sub - write that cell
 
wrote:
What am I doing wrong?
function xx (x as range) as whatever
x.value2 = "test"
or
x.text = "test"

[....]
Entered function in cell as xx(B5)


When VBA code is invoked directly or indirectly from a formula in an Excel,
the VBA code cannot modify cells directly.



All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com