Excel VBA - Create a Siren Effect Using Labels

Опубликовано: 01 Октябрь 2024
на канале: The World Of Algorithms
543
like

💡 Source Code

Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms&)

Private Sub UserForm_Activate()
With Me
.Left = Application.Left
.Top = Application.Top
.Width = Application.Width
.Height = Application.Height
End With
End Sub

Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Integer, c As Byte
For i = 1 To 100
DoEvents
If i Mod 2 = 0 Then
Label1.BackColor = vbRed
Label2.BackColor = vbBlue
Label3.BackColor = vbBlue
Label4.BackColor = vbRed
Else:
Label1.BackColor = vbBlue
Label2.BackColor = vbRed
Label3.BackColor = vbRed
Label4.BackColor = vbBlue
End If
Sleep 120
Next i
For c = 1 To 4
Me.Controls("Label" & c).BackColor = &HFFFFFF
Next c
End Sub
------------------------------------------------------------------------------------------

#excel
#msexcel
#msexceltutorial
#msexcelcourse
#vba
#vbatutorial
#excelvba
#fulltutorial
#excelvbatutorial
#microsoftexceltutorial
#tutorial
#exceltutorial
#advancedexcel
#advancedexceltraining
#tutor
#exceltutor
#exceltutoring
#exceltutoringonline
#onlineexceltutoring
#algorithm
#algorithms
#programming
#program
#script
#vbamacro
#vbamacros
#usingmacro
#veryuseful
#useful
#veryusefulmacro
#freeeducation
#freeprogramming
#freelancer
#excelfreelancer
#vbafreelancer
#freelanceservices
#vbalabel
#excelvbalabel
#excellabel
#labels
#doubleclick
#vbadoubleclick
#excelvbadoubleclick
#userform
#exceluserform
#excelvbauserform
#vbauserform
#siren
#sireneffect
#vbasireneffect
#excelvbasireneffect