+ Reply to Thread
Results 1 to 2 of 2

convert macro into formula

  1. #1
    Registered User
    Join Date
    11-02-2009
    Location
    NM, USA
    MS-Off Ver
    Excel 2003
    Posts
    26

    convert macro into formula

    I was given an excel worksheet to take over, and they had the info below as a macro in the sheet. Is there a way to just have this as a formula in the cell instead of having it as a macro? - Thanks Michelle
    -------------------------------------------
    Public Function CostCalc(IndCost, GrpCost, Students)

    If IndCost = "" And GrpCost = "" Then
    CostCalc = ""

    ElseIf IndCost <> "" And GrpCost = "" Then
    CostCalc = IndCost * Students

    ElseIf IndCost = "" And GrpCost <> "" Then
    CostCalc = ""

    ElseIf IndCost <> "" And GrpCost <> "" And (IndCost * Students) > GrpCost Then
    CostCalc = GrpCost * (Students / 30)

    ElseIf IndCost <> "" And GrpCost <> "" And (IndCost * Students) < GrpCost Then
    CostCalc = IndCost * Students

    ElseIf IndCost <> "" And GrpCost <> "" And (IndCost * Students) = GrpCost Then
    CostCalc = IndCost * Students

    Else
    Mon = "UNDEFINED"
    End If

    End Function

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,325

    re: convert macro into formula

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ 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