Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default ScreenUpdating not working.. Call Objects saved in XLA???

Hi,

I encounter a flickering problem with my program despite using
screenupdating. i suspect it is because I use select/activate, copy and paste
from different other worksheet which is seen as a LIBRARY. A sample of my
code is attached.

I wonder if it is possible to save the library in XLA and then call the
objects from XLA file using EXCEL VBA. Is it a better way of dealing the
flickering screen. If possible, i appreciate someone can tell me how to
accomplish it using Xla.

Look forward to your reply.
Best wishes, Loy



SAMPLE CODE

Public Sub OnshoreTrfr(ByVal myValue As Integer, myType As Integer)

Application.ScreenUpdating = False

Select Case myType
Case 1
If myValue = 1 Then
Sheets("LIB").Select
ActiveSheet.Shapes("Libon1x2wdgtrfr").Copy
Sheets("SLD").Select
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg1"
Selection.Left = 904
Selection.Top = 299
End If

If myValue = 2 Then
Sheets("LIB").Select
ActiveSheet.Shapes("Libon1x2wdgtrfr").Copy
Sheets("SLD").Select
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg1"
Selection.Left = 780
Selection.Top = 299
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg2"
Selection.Left = 1030
Selection.Top = 299
End If

Case 2
....

End Select
Sheet1.Select
Application.ScreenUpdating = True

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default ScreenUpdating not working.. Call Objects saved in XLA???

Loy,

..ScreenUpdating should not cause your screen to "flicker." Are you seeing
the screen move back and forth between worksheets as your various
Worksheet(index).Select statments execute? Are you stepping through your
code and noticing the screen move back and forth between worksheets (because
stepping through your code basically ignores the ScreenUpdating setting)?

Creating an xla file is not necessary and really depends on what you are
looking to do with this code. (Remember, your have a procedure and not a
function, and the way your code is written, it implies that you are calling
this code within VBA). You don't need ANY .Select statements in your code.
Excel VBA is object oriented. So, create worksheet and shape objects (and
whatever other objects you may need) and simply reference the object rather
than selecting the object.

For example, the code below will create two separate worksheet objects, and
change the name of each of the worksheets (without having to select the sheet
before applying the name change). I've also shown how to create a shape
object and how to change properties of the shape object via a With statement.
(The code is NOT tested and may not be the "most" efficient way to do
things, but it at least illustrates the point).

Dim wksOne As Worksheet
Dim wksTwo As Worksheet
Dim Shp As Shape

Set wksOne = Worksheets("LIB")
Set wksTwo = Worksheets("SLD")
Set Shp = wksOne.Shapes("Libon1x2wdgtrfr")

Shp.Copy
wksTwo.Paste

With Shp
.Name = "onstrfr1x2wdg1"
.Left = 904
.Top = 299
End With

wksOne.Name = "Worksheet 1"
wksTwo.Name = "Worksheet 2"

I hope this is helpful to you.

Best,

Matthew Herbert

"newbie" wrote:

Hi,

I encounter a flickering problem with my program despite using
screenupdating. i suspect it is because I use select/activate, copy and paste
from different other worksheet which is seen as a LIBRARY. A sample of my
code is attached.

I wonder if it is possible to save the library in XLA and then call the
objects from XLA file using EXCEL VBA. Is it a better way of dealing the
flickering screen. If possible, i appreciate someone can tell me how to
accomplish it using Xla.

Look forward to your reply.
Best wishes, Loy



SAMPLE CODE

Public Sub OnshoreTrfr(ByVal myValue As Integer, myType As Integer)

Application.ScreenUpdating = False

Select Case myType
Case 1
If myValue = 1 Then
Sheets("LIB").Select
ActiveSheet.Shapes("Libon1x2wdgtrfr").Copy
Sheets("SLD").Select
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg1"
Selection.Left = 904
Selection.Top = 299
End If

If myValue = 2 Then
Sheets("LIB").Select
ActiveSheet.Shapes("Libon1x2wdgtrfr").Copy
Sheets("SLD").Select
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg1"
Selection.Left = 780
Selection.Top = 299
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg2"
Selection.Left = 1030
Selection.Top = 299
End If

Case 2
....

End Select
Sheet1.Select
Application.ScreenUpdating = True

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default ScreenUpdating not working.. Call Objects saved in XLA???

Dear Matthew Herbert

Many thanks. It seems to work better this time.

Best wishes,
Loy

"Matthew Herbert" wrote:

Loy,

.ScreenUpdating should not cause your screen to "flicker." Are you seeing
the screen move back and forth between worksheets as your various
Worksheet(index).Select statments execute? Are you stepping through your
code and noticing the screen move back and forth between worksheets (because
stepping through your code basically ignores the ScreenUpdating setting)?

Creating an xla file is not necessary and really depends on what you are
looking to do with this code. (Remember, your have a procedure and not a
function, and the way your code is written, it implies that you are calling
this code within VBA). You don't need ANY .Select statements in your code.
Excel VBA is object oriented. So, create worksheet and shape objects (and
whatever other objects you may need) and simply reference the object rather
than selecting the object.

For example, the code below will create two separate worksheet objects, and
change the name of each of the worksheets (without having to select the sheet
before applying the name change). I've also shown how to create a shape
object and how to change properties of the shape object via a With statement.
(The code is NOT tested and may not be the "most" efficient way to do
things, but it at least illustrates the point).

Dim wksOne As Worksheet
Dim wksTwo As Worksheet
Dim Shp As Shape

Set wksOne = Worksheets("LIB")
Set wksTwo = Worksheets("SLD")
Set Shp = wksOne.Shapes("Libon1x2wdgtrfr")

Shp.Copy
wksTwo.Paste

With Shp
.Name = "onstrfr1x2wdg1"
.Left = 904
.Top = 299
End With

wksOne.Name = "Worksheet 1"
wksTwo.Name = "Worksheet 2"

I hope this is helpful to you.

Best,

Matthew Herbert

"newbie" wrote:

Hi,

I encounter a flickering problem with my program despite using
screenupdating. i suspect it is because I use select/activate, copy and paste
from different other worksheet which is seen as a LIBRARY. A sample of my
code is attached.

I wonder if it is possible to save the library in XLA and then call the
objects from XLA file using EXCEL VBA. Is it a better way of dealing the
flickering screen. If possible, i appreciate someone can tell me how to
accomplish it using Xla.

Look forward to your reply.
Best wishes, Loy



SAMPLE CODE

Public Sub OnshoreTrfr(ByVal myValue As Integer, myType As Integer)

Application.ScreenUpdating = False

Select Case myType
Case 1
If myValue = 1 Then
Sheets("LIB").Select
ActiveSheet.Shapes("Libon1x2wdgtrfr").Copy
Sheets("SLD").Select
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg1"
Selection.Left = 904
Selection.Top = 299
End If

If myValue = 2 Then
Sheets("LIB").Select
ActiveSheet.Shapes("Libon1x2wdgtrfr").Copy
Sheets("SLD").Select
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg1"
Selection.Left = 780
Selection.Top = 299
ActiveSheet.Paste
Selection.Name = "onstrfr1x2wdg2"
Selection.Left = 1030
Selection.Top = 299
End If

Case 2
....

End Select
Sheet1.Select
Application.ScreenUpdating = True

End Sub


Reply
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
screenupdating=false not working [email protected] Excel Programming 1 July 18th 08 09:58 PM
ScreenUpdating Not Working Matthew Pfluger Excel Programming 4 February 9th 08 04:58 AM
Screenupdating=false not working SteveF[_3_] Excel Programming 2 August 9th 07 06:16 PM
ScreenUpdating not working Otto Moehrbach Excel Programming 6 February 15th 07 02:00 PM
ScreenUpdating function not working? Paul J.[_2_] Excel Programming 5 September 26th 05 09:48 PM


All times are GMT +1. The time now is 03:33 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"