ต้องการคลิก CommandButton39 แล้วให้ TextBox4 แสดง ตามcell ฺB5,TextBox8 แสดง ตามcell ฺB5,
TextBox7 แสดง ตามcell ฺC5,TextBox5 แสดง ตามcell ฺD5,TextBox6 แสดง ตามcell ฺE5,label60 แสดง ตามcell ฺF5,และกดปุม start ให้ TextBox4 countdown และ กดปุ่ม stop ให้TextBox4 หยุด countdown ขอบคุณครับ
Code: Select all
Private Sub CommandButton39_Click()
On Error GoTo ErrorHandler
With TextBox4
.Value = Format(TimeValue(.Value), "hh:mm:ss")
ErrorHandler:
TextBox4.Value = Sheet2.Range("B5").Value
End With
With TextBox8
TextBox8.Value = Sheet2.Range("B5").Value
End With
With TextBox5
TextBox5.Value = Sheet2.Range("D5").Value
End With
With TextBox6
TextBox6.Value = Sheet2.Range("E5").Value
End With
With TextBox7
TextBox7.Value = Sheet2.Range("C5").Value
End With
End Sub
Private Sub CommandButton37_Click()
On Error GoTo ErrorHandler
With TextBox3
.Value = Format(TimeValue(.Value), "hh:mm:ss")
ErrorHandler:
.Value = Format(TimeValue(Now), "hh:mm:ss")
End With
End Sub
Private Sub CommandButton38_Click()
On Error GoTo ErrorHandler
With TextBox2
.Value = Format(TimeValue(.Value), "hh:mm:ss")
ErrorHandler:
.Value = Format(TimeValue(Now), "hh:mm:ss")
End With
End Sub
'Private Sub TextBox4_Change()
Sub startTimer()
Application.OnTime Now + TimeValue("00:00:01"), "nextTick"
End Sub
'Macro for next second
Sub nextTick()
Sheet1.Range("B1").Value = Sheet1.Range("B1").Value - TimeValue("00:00:01")
startTimer
End Sub
'Macro for stopping the timer (attached to the end button)
Sub stopTimer()
Application.OnTime Now - TimeValue("00:00:01"), "nextTick", , False
End Sub
You do not have the required permissions to view the files attached to this post.