-
Nov 20th, 2011, 07:01 AM
#1
Thread Starter
New Member
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
-
Nov 20th, 2011, 07:44 AM
#2
Re: Sub or Function Not Defined
Hi..
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.
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 20th, 2011, 07:52 AM
#3
Re: Sub or Function Not Defined
Moved To Office Development (which is the forum section for any questions related to VBA programming )
-
Nov 20th, 2011, 08:41 AM
#4
Thread Starter
New Member
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
-
Nov 20th, 2011, 12:43 PM
#5
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
-
Nov 20th, 2011, 02:53 PM
#6
Thread Starter
New Member
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
-
Nov 20th, 2011, 03:07 PM
#7
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
-
Nov 21st, 2011, 12:37 AM
#8
Re: Sub or Function Not Defined
and additionally, do you have those functions declared somewhere.
Clock_Start
RunAllfunction
Clock_Stop
Especially the "RunAllfunction" sounds like a namingproblem.
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|