Results 1 to 3 of 3

Excel function in VBA

Threaded View

  1. #1
    Registered User
    Join Date
    06-23-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2010/2007
    Posts
    34

    Excel function in VBA

    Hi guys, I'm trying to call the function "mduration" in VBA. It outputs the correct numbers but it always says: "type mismatch" after performing the calculations.

    Here's the code:

    
    
    Cell.Offset(0, 15).Formula = "=mduration(" & Chr(34) & Date & Chr(34) & ", " & Chr(34) & Cell.Offset(0, 6).Value & Chr(34) & ", " & Chr(34) & Cell.Offset(0, 4).Value / 100 & Chr(34) & ", " & Chr(34) & Cell.Offset(0, 14).Value / 100 & Chr(34) & ", " & Chr(34) & Cell.Offset(0, 5).Value & Chr(34) & ")"
    Cell.offset(0,14).value refers to yield. It has the following code which works fine:

    Cell.Offset(0, 14).Formula = "=yield(" & Chr(34) & Date & Chr(34) & ", " & Chr(34) & Cell.Offset(0, 6).Value & Chr(34) & ", " & Chr(34) & Cell.Offset(0, 4).Value / 100 & Chr(34) & ", " & Chr(34) & Cell.Offset(0, 12).Value & Chr(34) & "," & Chr(34) & 100 & Chr(34) & "," & Chr(34) & Cell.Offset(0, 5).Value & Chr(34) & ")*100"
    Cell.Offset(0, 14).Value = Cell.Offset(0, 14).Value
    Any suggestions as to how to combat the type mismatch error?
    Last edited by secondrate; 07-08-2010 at 10:39 PM.

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