Thread: VB Syntax
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default VB Syntax

Hi,

I would suggest you give your function a more intuative name because func1
won't mean much in 12 months time. Try this

Function func1(rng As Range) As Long
func1 = rng.Value + 1
End Function

Mike

"dhstein" wrote:

I'm trying to write a User Defined Function and need the VB syntax to refer
to the cell. For example if my function is called func1 and I put the
formula =func1(B2) in my spreadsheet, I want to manipulate the contents of B2
in my function.

What is the syntax to read/access the contents of cell B2 in my VB function?


For example:

function func1(Entry As Long)
CellContents = ?????????????
func1 = CellContents + 1
End Function

Thanks.