LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default coding and helping to launch vba

im using the following code

Sub test()
Dim x As Single, n As Integer, i As Integer, fact As Integer
n = Range("b3")
x = Range("a3")
'calculate n factorial
'checking B3
If Range("B3") <= 0 Or Int(Range("B3")) < Range("B3") Then
MsgBox " integer in b3 must be greater then zero"
Exit Sub
End If
fact = 1
For i = 1 To n
fact = fact * 1
Next i
'calculate result x ^ n/fact n!
result = x ^ n / fact
Range("c3") = result


where n =5 and x = 2 but is running into cell c3 32, which is 2 to
the
power 5 factorial


but i want to run 2 to the power 5 divided by n factorial, does
anyone
no anything i can put into this vba code to make it return this.


also i want to add some error checking, does anyone know how to add
that to the vba code


thanks

 
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
Getting rid of helping columns paulgallanter Excel Worksheet Functions 2 April 9th 06 12:16 AM
Need helping with my formula please... Altstatten Excel Worksheet Functions 1 March 14th 06 08:48 PM
TRY HELPING VISUALLY IMPAIRED TO USE YOUR APPLICATION PRODUCTS C Pierce Charts and Charting in Excel 1 February 16th 06 10:24 PM
tools helping understand calculations Dmitry Kopnichev Excel Discussion (Misc queries) 5 October 4th 05 06:37 AM
tools helping understand calculations Dmitry Kopnichev Excel Worksheet Functions 5 October 4th 05 06:37 AM


All times are GMT +1. The time now is 08:18 PM.

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

About Us

"It's about Microsoft Excel"