p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Excel VBA > Excel VBA
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 24th, 2009, 04:55 AM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old October 24th, 2009, 09:50 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
The Following User Says Thank You to joe1946 For This Useful Post:
snowman.hk (October 24th, 2009)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 06: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 02:21 PM
SQL2000 and Excel2000 VBA UDF luxcs Excel VBA 5 June 1st, 2004 01:54 PM



All times are GMT -4. The time now is 01:05 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc