LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Can this code be optimized?

I have the following code:

'--------------------------------------------------------
Sub TheCode()
Dim j As Integer
Dim newfile As String
Application.ScreenUpdating = False

For j = 1 To 5
Workbooks.Open Filename:="C:\main.xlsm"
newfile = "version" & CStr(j) & ".xlsm"
ActiveWorkbook.SaveAs Filename:="C:\" & newfile, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, _
CreateBackup:=False
Workbooks(newfile).Sheets(1).Range("A1") = "1"
Workbooks(newfile).Save
Workbooks(newfile).Close
Next j

Application.ScreenUpdating = True
End Sub
'--------------------------------------------------------

This code requires that a blank Excel file named "main.xlsm"
exists on the C: drive. The code then creates 5 new files on
the C: drive.

Does anyone know if this code can be improved or
optimized to run faster? Would anybody code this
differently?

I'm asking for a faster solution because this code seems
to run much much slower on Excel 2013, as compared to
Excel 2010. Are there any commands here that are
inefficient for Excel 2013?

Thanx!



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? [email protected] Excel Programming 4 May 29th 09 10:13 PM
How to determine the optimized correlation between 2 sets of data? Eric Excel Discussion (Misc queries) 1 March 7th 08 02:50 PM
optimized way for copying formats and values jerm Excel Programming 1 July 21st 07 12:18 AM
Excel code convert to Access code - Concat & eliminate duplicates italia Excel Programming 1 September 12th 06 12:14 AM
Question about creating Optimized Excel VBA/Formula Files Jeff S[_3_] Excel Programming 1 September 2nd 03 05:19 PM


All times are GMT +1. The time now is 08:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"