Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have been successful in keeping other macros from creating a flashing
screen upon running them, but the following two macros flicker when switching between worksheets even though I have added Application Screen updating = False as the first line and = True in the last line of the code. Does this happen because I am activating the Worksheets? If so how can I modify the code to ungroup and regroup the shapes to allow input from the users to change the text? Also any help in cleaning up the code which was modified after recording the macro would be appreciated. Joel Sub Regroup() Application.ScreenUpdating = False 'This Regroups the Curve Header Sheets("Curve").Activate ActiveSheet.Shapes.Range(Array("Curve Line No. 1", "Curve Line No. 2", _ "Curve Line No. 3", "Curve Line No. 4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Curve Header" 'This Regroups the Left Footer ActiveSheet.Shapes.Range(Array("Left Footer L1", "Left Footer L2", _ "Left Footer L3", "Left Footer L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Left Footer" 'This Regroups the Right Footer ActiveSheet.Shapes.Range(Array("Right Footer L1", "Right Footer L2", _ "Right Footer L3", "Right Footer L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Right Footer" 'This Regroups the Histogram Title Sheets("Histogram").Select ActiveSheet.Shapes.Range(Array("Histogram L1", "Histogram L2", _ "Histogram L3", "Histogram L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Histogram Title" Sheets("Curve").Activate Application.ScreenUpdating = True End Sub Sub Ungroup() ' Application.ScreenUpdating = False ' Ungroup Macro Worksheets("Curve").Activate ActiveSheet.Shapes.Range(Array("Curve Header", "Left Footer", "Right Footer")). _ Select Selection.ShapeRange.Ungroup.Select Sheets("Histogram").Activate ActiveChart.Shapes("Histogram Title").Select Selection.ShapeRange.Ungroup.Select Worksheets("Curve").Activate Application.ScreenUpdating = True End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joel,
Consider using object variables as I've demonstrated below. With object variables you don't need to .Select the shapes, which in turn means you don't need to activate the worksheet that contains them. 'This Regroups the Curve Header Dim ShpRng As ShapeRange Set ShpRng = Sheets("Curve").Shapes.Range(Array( _ "Curve Line No. 1", _ "Curve Line No. 2", _ "Curve Line No. 3", _ "Curve Line No. 4")) ShpRng.Group ShpRng.Name = "Curve Header" Regards, Vic Eldridge "Joel Mills" wrote: I have been successful in keeping other macros from creating a flashing screen upon running them, but the following two macros flicker when switching between worksheets even though I have added Application Screen updating = False as the first line and = True in the last line of the code. Does this happen because I am activating the Worksheets? If so how can I modify the code to ungroup and regroup the shapes to allow input from the users to change the text? Also any help in cleaning up the code which was modified after recording the macro would be appreciated. Joel Sub Regroup() Application.ScreenUpdating = False 'This Regroups the Curve Header Sheets("Curve").Activate ActiveSheet.Shapes.Range(Array("Curve Line No. 1", "Curve Line No. 2", _ "Curve Line No. 3", "Curve Line No. 4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Curve Header" 'This Regroups the Left Footer ActiveSheet.Shapes.Range(Array("Left Footer L1", "Left Footer L2", _ "Left Footer L3", "Left Footer L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Left Footer" 'This Regroups the Right Footer ActiveSheet.Shapes.Range(Array("Right Footer L1", "Right Footer L2", _ "Right Footer L3", "Right Footer L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Right Footer" 'This Regroups the Histogram Title Sheets("Histogram").Select ActiveSheet.Shapes.Range(Array("Histogram L1", "Histogram L2", _ "Histogram L3", "Histogram L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Histogram Title" Sheets("Curve").Activate Application.ScreenUpdating = True End Sub Sub Ungroup() ' Application.ScreenUpdating = False ' Ungroup Macro Worksheets("Curve").Activate ActiveSheet.Shapes.Range(Array("Curve Header", "Left Footer", "Right Footer")). _ Select Selection.ShapeRange.Ungroup.Select Sheets("Histogram").Activate ActiveChart.Shapes("Histogram Title").Select Selection.ShapeRange.Ungroup.Select Worksheets("Curve").Activate Application.ScreenUpdating = True End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Vic,
I revised my code as you suggested and this fixed the flickering (changing between worksheets). My project looks professional now thanks to your help. Joel "Vic Eldridge" wrote in message ... Hi Joel, Consider using object variables as I've demonstrated below. With object variables you don't need to .Select the shapes, which in turn means you don't need to activate the worksheet that contains them. 'This Regroups the Curve Header Dim ShpRng As ShapeRange Set ShpRng = Sheets("Curve").Shapes.Range(Array( _ "Curve Line No. 1", _ "Curve Line No. 2", _ "Curve Line No. 3", _ "Curve Line No. 4")) ShpRng.Group ShpRng.Name = "Curve Header" Regards, Vic Eldridge "Joel Mills" wrote: I have been successful in keeping other macros from creating a flashing screen upon running them, but the following two macros flicker when switching between worksheets even though I have added Application Screen updating = False as the first line and = True in the last line of the code. Does this happen because I am activating the Worksheets? If so how can I modify the code to ungroup and regroup the shapes to allow input from the users to change the text? Also any help in cleaning up the code which was modified after recording the macro would be appreciated. Joel Sub Regroup() Application.ScreenUpdating = False 'This Regroups the Curve Header Sheets("Curve").Activate ActiveSheet.Shapes.Range(Array("Curve Line No. 1", "Curve Line No. 2", _ "Curve Line No. 3", "Curve Line No. 4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Curve Header" 'This Regroups the Left Footer ActiveSheet.Shapes.Range(Array("Left Footer L1", "Left Footer L2", _ "Left Footer L3", "Left Footer L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Left Footer" 'This Regroups the Right Footer ActiveSheet.Shapes.Range(Array("Right Footer L1", "Right Footer L2", _ "Right Footer L3", "Right Footer L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Right Footer" 'This Regroups the Histogram Title Sheets("Histogram").Select ActiveSheet.Shapes.Range(Array("Histogram L1", "Histogram L2", _ "Histogram L3", "Histogram L4")).Select Selection.ShapeRange.Regroup.Select Selection.Name = "Histogram Title" Sheets("Curve").Activate Application.ScreenUpdating = True End Sub Sub Ungroup() ' Application.ScreenUpdating = False ' Ungroup Macro Worksheets("Curve").Activate ActiveSheet.Shapes.Range(Array("Curve Header", "Left Footer", "Right Footer")). _ Select Selection.ShapeRange.Ungroup.Select Sheets("Histogram").Activate ActiveChart.Shapes("Histogram Title").Select Selection.ShapeRange.Ungroup.Select Worksheets("Curve").Activate Application.ScreenUpdating = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.ScreenUpdating function question | Excel Worksheet Functions | |||
App.screenupdating | Excel Programming | |||
Simple Dumb Question: App.ScreenUpdating | Excel Programming | |||
Question on application.screenupdating | Excel Programming | |||
Screenupdating | Excel Programming |