Santaflare
New Member
- Joined
- Jan 4, 2017
- Messages
- 15
Hi,
I've tried to utilize VBA to enable smooth transitions between sheets. When activated a square shape is moved into cell A1 and gradually fills the screen before the sheet is changed. On the next sheet a similar shape is gradually becoming transparent (and later moved out of sight) to present the user with a new "page".
My problem is that even though I've disabled Screen Updating, the filled shapes are briefly transparent as the sheets changes (about a second), which kind of ruin the nice transition effect that I've tried to achieve.
Below is the code for the sheet change, followed by the two I've tried to use to enable the fade. Any ideas as to what might be interfering would be greatly appreciated!
I've tried to utilize VBA to enable smooth transitions between sheets. When activated a square shape is moved into cell A1 and gradually fills the screen before the sheet is changed. On the next sheet a similar shape is gradually becoming transparent (and later moved out of sight) to present the user with a new "page".
My problem is that even though I've disabled Screen Updating, the filled shapes are briefly transparent as the sheets changes (about a second), which kind of ruin the nice transition effect that I've tried to achieve.
Below is the code for the sheet change, followed by the two I've tried to use to enable the fade. Any ideas as to what might be interfering would be greatly appreciated!
VBA Code:
Sub Change_Sheet()
Call FadeOut
Application.ScreenUpdating = False
Sheets("2").Visible = True
Sheets("2").Activate
Sheets("Main Menu").Visible = xlSheetVeryHidden
Application.ScreenUpdating = True
Call FadeIN
End Sub
VBA Code:
Sub FadeOut()
Dim r As Range
With ActiveSheet.Shapes("Fade")
.Top = Range("A1").Top
.Left = Range("A1").Left
End With
ActiveSheet.Shapes("Fade").Select
Selection.ShapeRange.ZOrder msoBringToFront
Selection.ShapeRange.Fill.Transparency = 1
For i = 1 To 100
Selection.ShapeRange.Fill.Transparency = 1 - i / 100
DoEvents
Next
End Sub
VBA Code:
Sub FadeIN()
Dim r As Range
ActiveSheet.Shapes("Fade").Select
Selection.ShapeRange.ZOrder msoBringToFront
Selection.ShapeRange.Fill.Transparency = 1
For i = 1 To 100
Selection.ShapeRange.Fill.Transparency = i / 100
DoEvents
Next
With ActiveSheet.Shapes("Fade")
.Top = Range("A500").Top
.Left = Range("A500").Left
End With
End Sub