why this macro always gives my syntax error ?![]()
Sub CubeRoot() Num = InputBox(“Enter a positive number”) MsgBox Num ^ (1/3) & “ is the cube root.” End Sub
why this macro always gives my syntax error ?![]()
Sub CubeRoot() Num = InputBox(“Enter a positive number”) MsgBox Num ^ (1/3) & “ is the cube root.” End Sub
Last edited by syedfahadjalali; 03-02-2013 at 04:44 PM.
This works for me. I've changed the quotes ... did you copy this code from somewhere?
![]()
Sub CubeRoot() Dim Num Num = InputBox("Enter a positive number") MsgBox Num ^ (1 / 3) & " is the cube root." End Sub
Regards, TMS
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
if i copy any basic code from my tutorial pdf file it always give me systax error
Thanks after retyping the quotes it is working fine for me :D
yes i copied this code from a pdf tutorial
They're using a different double quote character ... so you will need to do a global replacement of what you get from your PDF file for this double quote (").
Regards, TMS
syedfahadjalali,
The following works for me:
![]()
Option Explicit Sub CubeRootV2() ' stanleydgromjr, 03/02/2013 ' http://www.excelforum.com/excel-programming-vba-macros/903853-my-some-basic-programms-always-show-syntax-error-when-i-run-macros.html Dim Num Num = InputBox("Enter a positive number") MsgBox (Num ^ 1 / 3 & " is the cude root of " & Num) End Sub
Have a great day,
Stan
Windows 10, Excel 2007, on a PC.
If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks