jrabenhorst
IS-IT--Management
Hi Folks,
I'm a VBA newbie and am having trouble with my macro freezing up during execution. The macro is relatively simple, highlighting and revealing certain aspects of the spreadsheet for a presentation (so screen updating needs to be turned on). The delays in the code are intentional. I'm not familiar with a simpler way to write this code so any advice on what may be causing the freezing issue would be very much appreciated. A subset of the code is shown below:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Demo_Wait()
' ROW 1
Range("H5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("G5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("F5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("E5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("D5").Select
With Selection.Font
.Color = -16776961
End With
Sleep 1500
Range("E5:H8").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
' Reset code
Thanks in advance for your help!
I'm a VBA newbie and am having trouble with my macro freezing up during execution. The macro is relatively simple, highlighting and revealing certain aspects of the spreadsheet for a presentation (so screen updating needs to be turned on). The delays in the code are intentional. I'm not familiar with a simpler way to write this code so any advice on what may be causing the freezing issue would be very much appreciated. A subset of the code is shown below:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Demo_Wait()
' ROW 1
Range("H5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("G5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("F5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("E5").Select
With Selection.Interior
.Color = 65535
End With
Sleep 1500
Range("D5").Select
With Selection.Font
.Color = -16776961
End With
Sleep 1500
Range("E5:H8").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
' Reset code
Thanks in advance for your help!