• VBA Function (XL97; SR-2)

    Author
    Topic
    #359626

    I’m trying to write a custom function that tests the value in one cell and if true references the value in another. I can do it for one cell using the “activecell” in the function but if I copy the formula down to other cells the value of the referred cell changes based on the location of the activecell.

    The custom function defined in the attached XL file is as follows:

    Function New1(Amount)
    If Amount = 4 Then
    New1 = ActiveCell.Offset(0, -1).Value
    End If
    End Function

    Viewing 0 reply threads
    Author
    Replies
    • #539531

      See if this does what you want:

      Function New1(Amount As Range)
          If Amount.Value = 4 Then
              New1 = Amount.Offset(0, 1).Value
          End If
      End Function
      
    Viewing 0 reply threads
    Reply To: VBA Function (XL97; SR-2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: