VBA function in excel that uses loop

cjgovi

New Member
Joined
Apr 11, 2010
Messages
4
Hi

I was asked to:

Create a VBA function in excel that uses loop and that prints "Hello World" 10 times.


I have searched the internet but cannot find anything

Do you know how to do this

thank you advance!
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,368
go to google & search for your thread title: VBA function in excel that uses loop
there are many good solutions
 
Last edited:

louisH

Board Regular
Joined
Mar 14, 2018
Messages
152
Hi,

I don't know what you mean by "printing", but here's the following :

Code:
    For i = 1 To 10
    
        'To display it on screen
        
        MsgBox "Hello World", Title:="Do your homework yourself"
        
        'To write it in cells
        
        Cells(i, 1).Value = "Hello World"
        
    Next i
 

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,368
(y) Well done. Google & the internet are a fantastic combination for learning. All the best
 

Watch MrExcel Video

Forum statistics

Threads
1,109,310
Messages
5,527,939
Members
409,793
Latest member
mavrik_stet

This Week's Hot Topics

Top