VBAString Tip 4: Excel VBA Loop Rows


In this post I will demonstrate how you can use Excel VBA to loop through certain rows on your worksheet, and then display their value.

First start off by entering a value in Column “A” of rows 1-14 (like in the following image:)

excel_vba_loop_rows

Also add a button called by default “Button1” and enter the following VBA code:

Sub Button1_Click()

       
    Dim intRow As Integer
    
    For intRow = 1 To 14
        MsgBox Range("A" & intRow)
        
    Next
    
    
    MsgBox "End.", vbInformation, "Complete"
End Sub

Watch it now:

Let me know if you have any questions

[simple_contact_form]

****************************************************