Created
November 6, 2017 07:59
-
-
Save pohzipohzi/1f67d5c6b230ba610e7dd48d39b111a9 to your computer and use it in GitHub Desktop.
Simple template for looping through table objects in excel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub tableloop() | |
Dim tbl As ListObject | |
Set tbl = ThisWorkbook.Worksheets("wsname").ListObjects("tblname") | |
Dim i As Integer | |
For i = 1 To tbl.ListRows.Count | |
Dim col1val, col2val As String | |
col1val = Trim(tbl.ListColumns("col1name").DataBodyRange(i, 1).Value) | |
col2val = Trim(tbl.ListColumns("col2name").DataBodyRange(i, 1).Value) | |
'do stuff with column values here | |
Next i | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment