Sub or Function Not Defined
Hi,
I am new to VBA programming and trying to write some code.
I wrote the following code.But when I run it, I get an error:
Compile Error:
Sub or function not defined
The highlighted code is: Run_Start
Code:
Sub Update_From_Local()
Clock_Start
RunAllfunction
Clock_Stop
End Sub
Sub RunAll()
'Application.ScreenUpdating = False
Run_Start
PasteDown ("SalesOrders")
PasteDown ("SupplyOrders")
PasteDown ("Inventory")
Stack ("DemandSupply")
Sort3 ("DemandSupply"), ("RecordType"), ("ItemCode"), ("HARD_Date")
PasteDownN ("DemandSupply"), 2
Sort2 ("DemandSupply"), ("ItemCode"), ("HARD_Cumulative")
PasteDownN ("DemandSupply"), 3
Sort3 ("DemandSupply"), ("RecordType"), ("ItemCode"), ("FIFO_Date")
PasteDownN ("DemandSupply"), 4
Sort2 ("DemandSupply"), ("ItemCode"), ("FIFO_Cumulative")
PasteDownN ("DemandSupply"), 5
Run_Stop
Sheets("Menu").Select
'Application.ScreenUpdating = True
End Sub
Could anyone tell me why? What have I done wrong or missed?
Appreciate any help I can get, still learning this stuff.
Regards
Bill
Re: Sub or Function Not Defined
Hi.. :wave:
The error is clearly saying about the problem. That sub or function(named "Run_Start") is not defined or VB can't find the definition of it(body of that function/sub). So, check whether you have defined that function or not. If not, you can define it. Otherwise, check for spelling mistakes.
:wave:
Re: Sub or Function Not Defined
Moved To Office Development (which is the forum section for any questions related to VBA programming :) )
Re: Sub or Function Not Defined
Thanks akhileshbc for the advice, now need to look at this more closely if this is missing.
I have read in the Microsoft help that it can be the reference, but when I review this, the "Reference" is grayed out, how to fix this?
Regards
Bill
Re: Sub or Function Not Defined
Bstafford
Your post shows code for Sub RunAll()
Do you also have code for Sub Run_Start()
(or is it named RunStart, which is different)
Spoo
Re: Sub or Function Not Defined
Hi Spoo,
There is no other sub for Run_Start(), but only RunAll(),
maybe you are right and need to change the name. Thanks
for the reply, will try a few things again and let you know.
Bill
Re: Sub or Function Not Defined
Bill
If that is the case, then why do you have these lines of code?
Code:
Sub RunAll()
'Application.ScreenUpdating = False
Run_Start
PasteDown ("SalesOrders")
PasteDown ("SupplyOrders")
PasteDown ("Inventory")
Stack ("DemandSupply")
Sort3 ("DemandSupply"), ("RecordType"), ("ItemCode"), ("HARD_Date")
PasteDownN ("DemandSupply"), 2
Sort2 ("DemandSupply"), ("ItemCode"), ("HARD_Cumulative")
PasteDownN ("DemandSupply"), 3
Sort3 ("DemandSupply"), ("RecordType"), ("ItemCode"), ("FIFO_Date")
PasteDownN ("DemandSupply"), 4
Sort2 ("DemandSupply"), ("ItemCode"), ("FIFO_Cumulative")
PasteDownN ("DemandSupply"), 5
Run_Stop
Sheets("Menu").Select
'Application.ScreenUpdating = True
End Sub
Spoo
Re: Sub or Function Not Defined
and additionally, do you have those functions declared somewhere.
Quote:
Clock_Start
RunAllfunction
Clock_Stop
Especially the "RunAllfunction" sounds like a namingproblem.