Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default programme fucntioning problems errors

number,x, from cell A3 and a positive integer, n, from cell B3 then
returns into cell C3 the value of x raised to the power n divided by
n factorial.

where x in cell a3 = 2 and n in cell b3 = 5


im using this formula, but when i run it nothing happens, how do i
make this vba programme run and return the value?


the vba programmes is ok its just no running anything or doing
anything
to my spreadsheet when i need it to return into cell C3


i think i need to delcare the vaiables, but not sure how to doo it.


basically i need help in order for my spreasheet of the numbers x and
n to return in cell a3 the value of x raised tot he power n divided
by
n factorial but nothin is happening in the spreadhseet, can any one
tell me or show me how to do this


please i really want to do this, but cant


this is the vba programme:


Public Function MyFunction(X As Double, N As Long) As Variant
If (N <= 0&) _
Then
MyFunction = "N must be an integer greater than zero"
Else
MyFunction = (X ^ N) / WorksheetFunction.Fact(N)
End If
End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default programme fucntioning problems errors

The functhin works fine for me. Might want to put in
Application.Volatile though so that the formula is recalculated each
time a change takes place on the worksheet.
Public Function MyFunction(X As Double, N As Long) As Variant
Application.Volatile
If (N <= 0) Then
MyFunction = "N must be an integer greater than zero"
Else
MyFunction = (X ^ N) / WorksheetFunction.Fact(N)
End If
End Function
paul wrote:
number,x, from cell A3 and a positive integer, n, from cell B3 then
returns into cell C3 the value of x raised to the power n divided by
n factorial.

where x in cell a3 = 2 and n in cell b3 = 5


im using this formula, but when i run it nothing happens, how do i
make this vba programme run and return the value?


the vba programmes is ok its just no running anything or doing
anything
to my spreadsheet when i need it to return into cell C3


i think i need to delcare the vaiables, but not sure how to doo it.


basically i need help in order for my spreasheet of the numbers x and
n to return in cell a3 the value of x raised tot he power n divided
by
n factorial but nothin is happening in the spreadhseet, can any one
tell me or show me how to do this


please i really want to do this, but cant


this is the vba programme:


Public Function MyFunction(X As Double, N As Long) As Variant
If (N <= 0&) _
Then
MyFunction = "N must be an integer greater than zero"
Else
MyFunction = (X ^ N) / WorksheetFunction.Fact(N)
End If
End Function


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default programme fucntioning problems errors

The code worrks ok. You don't need to declare variables. If you did you
would of gotten an error. Make sure you placed the code on a module page in
VBA.

"paul" wrote:

number,x, from cell A3 and a positive integer, n, from cell B3 then
returns into cell C3 the value of x raised to the power n divided by
n factorial.

where x in cell a3 = 2 and n in cell b3 = 5


im using this formula, but when i run it nothing happens, how do i
make this vba programme run and return the value?


the vba programmes is ok its just no running anything or doing
anything
to my spreadsheet when i need it to return into cell C3


i think i need to delcare the vaiables, but not sure how to doo it.


basically i need help in order for my spreasheet of the numbers x and
n to return in cell a3 the value of x raised tot he power n divided
by
n factorial but nothin is happening in the spreadhseet, can any one
tell me or show me how to do this


please i really want to do this, but cant


this is the vba programme:


Public Function MyFunction(X As Double, N As Long) As Variant
If (N <= 0&) _
Then
MyFunction = "N must be an integer greater than zero"
Else
MyFunction = (X ^ N) / WorksheetFunction.Fact(N)
End If
End Function


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
PROGRAMME HELP paul[_17_] Excel Programming 2 July 30th 07 11:46 AM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Does excel VBA programme has a size limit? Or some other problems caused this problem? [email protected] Excel Programming 3 June 20th 06 05:06 PM
Brainstorming possible file errors/problems Nick Hebb Excel Programming 3 October 1st 05 12:35 AM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM


All times are GMT +1. The time now is 12:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"