ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding macro (https://www.excelbanter.com/excel-programming/281800-hiding-macro.html)

Angeliki

Hiding macro
 
Hello
I wrote a code that copys values from one workbook to another workbook.
The problem is that when goes from one workbook to another there is a
flickering in the screen. Eventhough i wrote application.screenupdating
still showing macros executions
Can you tell me how to hide macro execution?Thanks in advance

Thanks
AngelikiS



application.screenupdating= False

Windows("Book1").Activate
Sheets("Information").Select
Range("A1:I12").Select
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Columns("A:I").Select
Columns("A:I").EntireColumn.AutoFit
Range("A1").Select
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Information"

Windows("Book1").Activate
Application.CutCopyMode = False
Range("A1").Select

application.screenupdating= True









Tom Ogilvy

Hiding macro
 
The best way is not to use select and activate

Workbooks("Book1.xls").Worksheets("Sheet1").Range( "C9:M20").Copy _
Destination:=Workbooks("Book2.xls").worksheets("Da ta").Range("A11")

Does not cause the screen to flicker as an example.

Application.ScreenUpdating = False
is the only built in command that freezes the screen. If it is not working
in your case, it is probably a coding error or you are calling a routine
that changes it to True (for example, some of the procedures in the
Analysis toolpak).

--
Regards,
Tom Ogilvy

"Angeliki" wrote in message
...
Hello
I wrote a code that copys values from one workbook to another workbook.
The problem is that when goes from one workbook to another there is a
flickering in the screen. Eventhough i wrote application.screenupdating
still showing macros executions
Can you tell me how to hide macro execution?Thanks in advance

Thanks
AngelikiS



application.screenupdating= False

Windows("Book1").Activate
Sheets("Information").Select
Range("A1:I12").Select
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Columns("A:I").Select
Columns("A:I").EntireColumn.AutoFit
Range("A1").Select
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Information"

Windows("Book1").Activate
Application.CutCopyMode = False
Range("A1").Select

application.screenupdating= True











patrick molloy

Hiding macro
 

With Workbooks("Book2").ActiveSheet

Workbooks("Book1").Sheets("Information").Range
("A1:I12").Copy

.Range("A1").PasteSpecial xlValues
.Range("A1").PasteSpecial xlFormats
.Columns("A:I").Select
.Columns("A:I").EntireColumn.AutoFit
.Range("A1").Activate
.Name = "Information"

Windows("Book1").Activate
Application.CutCopyMode = False
Range("A1").Select

End With

HTH

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Hello
I wrote a code that copys values from one workbook to

another workbook.
The problem is that when goes from one workbook to

another there is a
flickering in the screen. Eventhough i wrote

application.screenupdating
still showing macros executions
Can you tell me how to hide macro execution?Thanks in

advance

Thanks
AngelikiS



application.screenupdating= False

Windows("Book1").Activate
Sheets("Information").Select
Range("A1:I12").Select
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlValues,

Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats,

Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Columns("A:I").Select
Columns("A:I").EntireColumn.AutoFit
Range("A1").Select
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Information"

Windows("Book1").Activate
Application.CutCopyMode = False
Range("A1").Select

application.screenupdating= True








.



All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com