Computer Science, asked by jayesh91, 1 year ago

how to write loop programs in vba

Answers

Answered by nqw46119
1

Answer:

Sub Hello()

dim a as string

do until a = "10"

a = a + 1

msgbox "Hello"

loop

Try This!

You can also do it using:

do

msgbox "Hello"

loop

but it will run infinitely

If you want to have fun:

Sub Speak()

dim sapi as Object

dim Username

Username = Environ("username")

set sapi = CreateObject("sapi.spvoice")

sapi.speak "Hello " & Username

Explanation:

The until is used to specify when the loop will end you can change 10 to any number if you enter 100 hundred message boxes will appear

dim is used to declare a variable

Similar questions