PDA

View Full Version : Filling a range of cells using a VBA function



j0hn
04-08-2011, 12:05 AM
I am attempting to figure out how to fill a range of cells with values using a VBA function. Using the Value property does not work for any reason. The code below depicts my current idea:

Public Function funcA(CellRange as Range)
CellRange.Value = "MY_VALUE"
funcA = "OK"
End Function

where 'CellRange' is the range in the sheet, which should be filled with the result.

Any idea how to achieve this?

Many thanks for your help

Bob Phillips
04-08-2011, 01:33 AM
Why not just select the range, type the value in the formula bar, and hit Ctrl-End?

j0hn
04-08-2011, 01:38 AM
funcA is a wrapper around the rtd function. Eachtime when the rtd gets called, i want the result to be chunked/parsed in pieces and than to be written into multiple cells.