ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using vba code to find the square root of a number (https://www.excelbanter.com/excel-programming/305956-re-using-vba-code-find-square-root-number.html)

Chip Pearson

using vba code to find the square root of a number
 
NK,

Try something like the following:

Dim N As Double
Dim P As Double
N = 27
P = N^(1/3)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"NK" wrote in message
...
Hi

I am trying to code a formula that invloves taking the square

root of the number and for some reason the vba code won't let me
do it. I can set it up so it runs it's using the excel function
(which won't seem to call itself in teh code either) in an excel
book but I would prefer to keep it all in the code.

Any help would be appreciated.

Thanks

NK




Chip Pearson

using vba code to find the square root of a number
 
P = N^(1/3)

Of course, that should be P=N^(1/2)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Chip Pearson" wrote in message
...
NK,

Try something like the following:

Dim N As Double
Dim P As Double
N = 27
P = N^(1/3)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"NK" wrote in message
...
Hi

I am trying to code a formula that invloves taking the square

root of the number and for some reason the vba code won't let

me
do it. I can set it up so it runs it's using the excel

function
(which won't seem to call itself in teh code either) in an

excel
book but I would prefer to keep it all in the code.

Any help would be appreciated.

Thanks

NK







All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com