macro to return value of cell in the next row

January 19, 2011 at 02:59:51
Specs: Windows XP
I am trying to write a function in VB that takes a cell reference as argument and returns the value of the cell one row below the referenced cell.

Using the foll. code:

Function Test(ByRef varr1 As Range) As String
Test = varr1.Offset(1, 0).Value
End Function

But getting a #value error. Any ideas on what I'm doing wrong?

See More: macro to return value of cell in the next row

Report •

January 19, 2011 at 06:19:46
There's nothing wrong with the code itself - it works fine for me.

The only thing I would change is to add Application.Volatile so that it updates automatically.

However. that has nothing to do with your #VALUE error.

Tell us more about your data, where you stored the code, how you are using it, etc.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •
Related Solutions

Ask Question