Macro "sub or function not defined"

Graham52

New Member
Joined
Jan 26, 2019
Messages
14
Hi there,
I have a macro that works fine but it seems everytime I do other work and come back to it I get this message "sub or function not defined". I have debugged it and get the following, this is the macro. I am using a Mac computer and suspect the problem may be related.
Code:
Sub SaveQoteWithNewQote()
        Dim NewFN As Variant
        ' Copy Qote to a new workbook
        ActiveSheet.Copy
        NewFN = "desktop\quotes\Quote" & Range("B1").Value & ".xlsx"
        ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
        ActiveWorkbook.Close
        NextQote
        
End Sub

The first line is is highlighted yellow and the last line (NextQote) is blue. I don't understand why it works sometimes but then refuses to work.

Thanks for any help you can give.
Graham
 
Last edited by a moderator:
So sorry for this but I also have this macro running if that's what you mean,

Sub NextQote2()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Range("B1").Value = ws.Range("B1") + 1
ws.Range("A22,B6,D1,D2,D3,F20,F25,G24,G25,H25,I24,I25,I27,J20, J25,J27,K20,K21,L25").ClearContents
Next
End Sub
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Unless you have a macro that starts with Sub NextQote(), your first code won't ever work since its calling a routine called NextQote and you don't seem to have one.
 
Upvote 0
Hi Rory thank you so much for your reply and I worked that out and now solved my own question. Only thing now is that the path I have selected it to save the file is not working, it only saves to my desktop. I think its a Mac thing, it seems it was I just used the forward slash instead of the back slash and all is good.

Thanks for your interest
Graham
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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