P
Pieter Kuyck
Tim
You use Activate and Select so the Windows will show despite .ScreenUpdating = False.
Combine the functions of copy - paste to one line
'Copy the YEAR - in one line with space between ....Copy Workbooks.....
Workbooks(OldFileName).Sheets("Company").Range("K3:N6").Copy Workbooks(NewFileName).Sheets("Company").Range("K3:N6")
it's also faster
Pieter
| I have a macro that opens another excel file and copes info from it
| into the file that is running the macro. The info is copies from 20
| different sheets and is copied into 20 different sheets. I use
| Application.ScreenUpdating = False but the screen still flashes and is
| updated every time I go from workbook to workbook. What can I do to
| the code below that will update the screen only after all info has
| been copies?
|
|
|
|
| Application.ScreenUpdating = False
| Application.DisplayAlerts = False
|
| 'Copy the YEAR
| Windows(OldFileName).Activate
| Sheets("Company").Select
| Range("K3:N6").Copy
|
| Windows(NewFileName).Activate
| Sheets("Company").Select
| Range("K3:N6").Select
| ActiveSheet.Paste
|
| 'Copy the Company Info
| Windows(OldFileName).Activate
| Sheets("Company").Select
| Range("F9:I16").Copy
|
| Windows(NewFileName).Activate
| Sheets("Company").Select
| Range("F9:I16").Select
| ActiveSheet.Paste
|
|
| Application.CutCopyMode = False
|
| 'Close Old File
| Windows(OldFileName).Activate
| ActiveWindow.Close
You use Activate and Select so the Windows will show despite .ScreenUpdating = False.
Combine the functions of copy - paste to one line
'Copy the YEAR - in one line with space between ....Copy Workbooks.....
Workbooks(OldFileName).Sheets("Company").Range("K3:N6").Copy Workbooks(NewFileName).Sheets("Company").Range("K3:N6")
it's also faster
Pieter
| I have a macro that opens another excel file and copes info from it
| into the file that is running the macro. The info is copies from 20
| different sheets and is copied into 20 different sheets. I use
| Application.ScreenUpdating = False but the screen still flashes and is
| updated every time I go from workbook to workbook. What can I do to
| the code below that will update the screen only after all info has
| been copies?
|
|
|
|
| Application.ScreenUpdating = False
| Application.DisplayAlerts = False
|
| 'Copy the YEAR
| Windows(OldFileName).Activate
| Sheets("Company").Select
| Range("K3:N6").Copy
|
| Windows(NewFileName).Activate
| Sheets("Company").Select
| Range("K3:N6").Select
| ActiveSheet.Paste
|
| 'Copy the Company Info
| Windows(OldFileName).Activate
| Sheets("Company").Select
| Range("F9:I16").Copy
|
| Windows(NewFileName).Activate
| Sheets("Company").Select
| Range("F9:I16").Select
| ActiveSheet.Paste
|
|
| Application.CutCopyMode = False
|
| 'Close Old File
| Windows(OldFileName).Activate
| ActiveWindow.Close