Create a button that counts with multiples of three when cli

Create a button that counts with multiples of three when clicked. The user experience is the following: I click the button, and it shows a message box with a 3 and an Ok button to dismiss the message box. Then the macro ends. But if I click the button again, it will say, “6.” If I click the button two more times, it will say “9” and then “12.” Each time I click the button, the number will increase unless I close Excel and reopen the spreadsheet. EXCEL VBA

Solution

drag and drop a command button and rename it as clickme

so here the invovled is very simple, we will just count the hits and multiply it with 3. here we go

Private Sub ClickME_Click()

Static hits As Integer

hits = hits + 1

Call numberChanger(hits)

End Sub

Sub numberChanger(i As Integer)

MsgBox i * 3

End Sub

Create a button that counts with multiples of three when clicked. The user experience is the following: I click the button, and it shows a message box with a 3

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site