• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

how to display numbers in msgbox

shiva_B

New Member
Hi,

I'm new to vba. I want to display 15 numbers in msgbox at a time by using newline/space between numbers (i want to use do while loop) . pls assist me.


regards
shiva
 
Try this...
Code:
Sub DispMsgBox()
    Dim i As Byte
    Dim msgcontent As String
    i = 1
    msgcontent = ""
    While i <= 15
        If Trim(Len(msgcontent)) = 0 Then
            msgcontent = i
        Else
            msgcontent = msgcontent & vbCrLf & i
        End If
        i = i + 1
    Wend
    MsgBox msgcontent, vbInformation
End Sub

The keyword vbCrLf is used for inserting a new line character.. you can replace the same with any seperator such as Space or any other character
 
Back
Top