Sub Or Function Not Defined

AlextheTrader

New Member
Joined
Jul 25, 2014
Messages
11
I am only 1 week to learning VBA. So I am still learning the basics. I am building this code to calculate the expected move of a stock.

I am getting a Sub or Function Not Defined message. What should I fix.

Sub Expected_Move()


Dim Stock_Price As Double
Dim Impl_Vol As Double
Dim Time_Period As Double
Dim Square As Single
Dim IV_Adjust As Single
Dim Exp_Move As Single


Dim Sp As Range
Dim Iv As Range
Dim Tp As Range

Sp = Range("A2")
Iv = Range("B2")
Tp = Range("C2")


Stock_Price = Sp
Impl_Vol = Iv
Time_Period = Tp




Square = Sqrt(Time_Period / 365)


IV_Adjust = Stock_Price * Impl_Vol


Exp_Move = IV_Adjust * Square




Worksheets(1).Range("D2").Value = Exp_Move






End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,217,076
Messages
6,134,424
Members
449,872
Latest member
Big Jake

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top