Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 24th, 2009, 08:47 AM
Posts: n/a
Question #NAME? error running Excel 2003 VBA in Excel 2007


I made a spreadsheet in XL03 but the VBA functions will not calculate in XL07!

I have saved it as macro enabled, the module exists, the functions appear in the fx dropdown list as I type!

I have set the "Trust Center" options in various ways but can not get rid of the error.

One of my functions:-
Function timval(tim_str As String) As Single

Dim hrh As Single
Dim minh As Single

hrh = 1 / 24
minh = hrh / 60

Dim hr_st As String
Dim min_st As String
Dim hr As Single
Dim min As Single

' extract hours and minutes from string
hr_st = Mid(tim_str, 1, 2)
min_st = Mid(tim_str, 4, 2)

' convert to numeric
If IsNumeric(hr_st) Then
    hr = hr_st
    hr = 0
End If
If IsNumeric(min_st) Then
    min = min_st
    min = 0
End If

' calculate time value in excel format
timval = (hr * hrh) + (min * minh)

End Function
Hope someone can help.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Conversion Excel 2003 VBA codes to Excel 2007 sunny76 BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 0 August 13th, 2009 05:38 AM
SAving into Excel 2003 or 2007 ppenn Excel VBA 2 August 12th, 2009 09:35 AM
excel 2007 vba UDF DavidReese BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 1 February 24th, 2009 01:10 AM
Error 50290: VBA in Excel 2003 doing strange thing Andraw Pro VB 6 0 October 29th, 2008 08:44 AM
VBA Print preview in Excel 2007 solnajeff Excel VBA 1 June 23rd, 2008 01:21 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.