How to loop through a Row in Excel Using VBA

Triton Coding
Triton Coding
434 بار بازدید - 5 سال پیش - This tutorial shows how to
This tutorial shows how to use Visual Basic for Applications (VBA) to loop through the row data in Excel. This specific example returns the values in a selected row range using a message box. It can be modified to perform editing operations on rows and count data for imports or exports. The code is included below for easy copying and pasting.

Public Function RowLoop()
Dim rng As Range: Set rng = Sheet1.Range("A2:D2")
Dim i As Integer
For i = 1 To rng.Columns.Count
MsgBox rng.Cells(RowIndex:=1, ColumnIndex:=i).Value
Next


End Function
5 سال پیش در تاریخ 1398/07/14 منتشر شده است.
434 بـار بازدید شده
... بیشتر