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, 03:55 AM
Registered User
 
Join Date: Oct 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Question Excel 2007 VBA UDF problem

Hi, i'm new to Excel VBA. I'm trying to create the same UDF as the centigrade to fahrenheit one. Tried to create a new one with same structure as the sample code, just different naming, but the result is zeros for every value of C. Could anyone help?

Code:
Function CtoF(degreeC)
    degreeCtoF = degreeC * 9 / 5 + 32
End Function
 
Old October 24th, 2009, 08:50 AM
Registered User
 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 2 Times in 2 Posts
Default

The value has to be returned in a variable with the same name as the function itself, like this:
Code:
Function CtoF(degreeC)
    CtoF = degreeC * 9 / 5 + 32
End Function
The Following User Says Thank You to joe1946 For This Useful Post:
snowman.hk (October 24th, 2009)





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
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
Excel 2007 VBA PRogrammers Reference SteveB BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 18 February 12th, 2009 06:13 AM
VBA Print preview in Excel 2007 solnajeff Excel VBA 1 June 23rd, 2008 01:21 PM
SQL2000 and Excel2000 VBA UDF luxcs Excel VBA 5 June 1st, 2004 12:54 PM





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