alainfranco
New Member
- Joined
- Mar 7, 2012
- Messages
- 38
Greetings,
I am going bald. Bald from all the hair I've been pulling off trying to fix an issue I apparently do not understand, caused by a problem I didn't know was one before this occurred. Please help.
And now with the context: My workbook was built on Excel 2013 on Windows 7. I use this file to log billable services and then to generate invoices, leveraging stand alone Client Billing Templates, sitting in the same folder as the Registry. All Client Billing Template have a tab called "Template" which is identical from one file to another, with the exception of Client specific information such as addresses and etc....
This tab is copied, pasted in the same file, and data is then copied from the Registry file, into it. Saved and exported to PDF. Simple enough, and worked like a charm until I dropped my laptop, which was later pronounced dead, and ultimately replaced by a new one running Excel 2016, on Windows 10, if that matters at all.
While most of the workbook works as designed on my new laptop, there are a few macros that no longer work, and I have spent countless hours trying to figure it out, using my limited knowledge of VBA.
What happens is that the macro works fine, until it hits a precise point in the script, and then unexpectedly stops, for no apparent reason. Again, always at the same place, judging from what I can see when I run the macro using F8.
Here is an excerpt of the code:
The line that seems to be causing it is :
Sheets("Template").Copy After:=Worksheets(Worksheets.Count)
Does any one know why this is happening and how I can fix it?
Eternal recognition for the person who can help....!
Many thanks,
****** id="cke_pastebin" style="position: absolute; top: 600.8px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> Sheets("Template").Copy After:=Worksheets(Worksheets.Count)
</body>
I am going bald. Bald from all the hair I've been pulling off trying to fix an issue I apparently do not understand, caused by a problem I didn't know was one before this occurred. Please help.
And now with the context: My workbook was built on Excel 2013 on Windows 7. I use this file to log billable services and then to generate invoices, leveraging stand alone Client Billing Templates, sitting in the same folder as the Registry. All Client Billing Template have a tab called "Template" which is identical from one file to another, with the exception of Client specific information such as addresses and etc....
This tab is copied, pasted in the same file, and data is then copied from the Registry file, into it. Saved and exported to PDF. Simple enough, and worked like a charm until I dropped my laptop, which was later pronounced dead, and ultimately replaced by a new one running Excel 2016, on Windows 10, if that matters at all.
While most of the workbook works as designed on my new laptop, there are a few macros that no longer work, and I have spent countless hours trying to figure it out, using my limited knowledge of VBA.
What happens is that the macro works fine, until it hits a precise point in the script, and then unexpectedly stops, for no apparent reason. Again, always at the same place, judging from what I can see when I run the macro using F8.
Here is an excerpt of the code:
Code:
Sub WeeklyInvoicing()
Application.ScreenUpdating = False
' Set environment parameters and variables
BillableClient = ThisWorkbook.ActiveSheet.Cells(1, 17).Value
BillingDay = ThisWorkbook.ActiveSheet.Cells(4, 1).Value
PathOfFile = "C:\Users\xxx\MyDocs\BillingTemplates\"
NameOfFile = BillableClient
ExtentionOfFile = ".xlsm"
'Create an Invoice Worksheet in the Client Billing Template
Workbooks.Open Filename:=PathOfFile & NameOfFile & ExtentionOfFile
Sheets("Template").Select
Sheets("Template").Copy After:=Worksheets(Worksheets.Count)
[U][B]THIS IS THE PRECISE SPOT WHERE THE MACRO STOPS, FOR NO APPARENT REASON
[/B][/U]
......... Rest of the Macro which does what I described above.
The line that seems to be causing it is :
Sheets("Template").Copy After:=Worksheets(Worksheets.Count)
Does any one know why this is happening and how I can fix it?
Eternal recognition for the person who can help....!
Many thanks,
****** id="cke_pastebin" style="position: absolute; top: 600.8px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> Sheets("Template").Copy After:=Worksheets(Worksheets.Count)
</body>