Thread: VB Syntax
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default VB Syntax

Function bumpit(r As Range) As Long
bumpit = r.Value + 1
End Function

and in some cell:
=bumpit(A1)
--
Gary''s Student - gsnu200812


"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.