Create an Amazing Effect Using MouseMove Event in Excel Using Macro|Buttons That Move Up and Down

Опубликовано: 05 Октябрь 2024
на канале: The World Of Algorithms
2,265
like

💡 Source Code

Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms&)
Dim b As Boolean

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

Sub ImgTop()
Dim i As Byte

i = 1
While i ◀= 8
Controls("Image" & i).Top = 426
i = i + 1
Wend

End Sub

Sub ImgMove(ByVal ind As Byte)
Dim i As Integer

b = -1
Call ImgTop
i = 426
While i ▶= 390
DoEvents
Controls("Image" & ind).Top = i
Sleep 5
i = i - 2
Wend

End Sub

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
b = 0
Call ImgTop
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(1)
End Sub

Private Sub Image2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(2)
End Sub

Private Sub Image3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(3)
End Sub

Private Sub Image4_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(4)
End Sub

Private Sub Image5_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(5)
End Sub

Private Sub Image6_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(6)
End Sub

Private Sub Image7_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(7)
End Sub

Private Sub Image8_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If b = 0 Then Call ImgMove(8)
End Sub

------------------------------------------------------------------------------------------
Buy a Cofee ☕ for theworldofalgorithms: https://ko-fi.com/theworldofalgorithms

🥰Thank you for the donation. I am deeply grateful for your help!🥰
------------------------------------------------------------------------------------------

#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
#vbauserform
#excelvbauserform
#mousemove
#mousemoveevent
#vbauserformevent
#vbaimageevent
#animatedbuttons
#movingbuttons