+ Reply to Thread
Results 1 to 2 of 2

wHAT AM i DOING wrong

  1. #1
    DMB
    Guest

    wHAT AM i DOING wrong



    'Public Function DisplayCellFunction(cellID1 As String, cellID2 As String)
    Public Function DisplayCellFunction(cellID1 As Integer, cellID2 As Integer)
    'Copy formulas to the adjacent cell for visual verification
    'Range(cellID1) = "'" & Range(cellID2).Formula
    Range("F26") = "'" & Range("d26").Formula
    End Function


    In the workbook I enter

    =DisplayCellFunction(F26, D26)
    I get a #Name Error

    =DisplayCellFunction("F26", "D26")
    I get a #Name Error

    =DisplayCellFunction(6, 6)
    I get a #Value! Error




  2. #2
    Registered User
    Join Date
    08-18-2004
    Posts
    16
    Quote Originally Posted by dmb
    'Public Function DisplayCellFunction(cellID1 As String, cellID2 As String)
    Public Function DisplayCellFunction(cellID1 As Integer, cellID2 As Integer)
    'Copy formulas to the adjacent cell for visual verification
    'Range(cellID1) = "'" & Range(cellID2).Formula
    Range("F26") = "'" & Range("d26").Formula
    End Function


    In the workbook I enter

    =DisplayCellFunction(F26, D26)
    I get a #Name Error

    =DisplayCellFunction("F26", "D26")
    I get a #Name Error

    =DisplayCellFunction(6, 6)
    I get a #Value! Error
    A Function procedure cannot change the value of another cell. You have to use a Sub procedure to do that.

    You might try to entering a function in the cell where you want the formula from the adjacent cell displayed.

    Try this code for that function

    Please Login or Register  to view this content.
    Use this syntax:
    =DisplayCellFunction("A1")

    The Application.Volatile Statement recalculates the value of the function any time data changes on the sheet. i.e. if you were to change the formula that cell references, unless you have Application.Volatile, it won't change the result of your function.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1