I have a userform with three buttons. When Ok button is clicked i wrote the below code:
Private Sub CommandButton2_Click()
Call calculateCost
End Sub
and the sub method i wrote in the Sheet1 is:
Public Sub calculateCost()
Dim kilo As String
kilo = Worksheets("Sheet1").TextBox1.Text
MsgBox "value" & kilo
End Sub
When im running the code im getting the error. Sub or function not defined near call calculateCost. Why is this happening? How to resolve this. Thankyou