In this example, myTable is a variable that holds a reference to the table named "Table1" on the worksheet named "Sheet1". myColumn is a variable that holds a reference to the first column of the table, which we obtain using the ListColumns property of the table and specifying the header name "Column1".
You can now use the myColumn variable in your VBA code to reference the desired column of the table, just as you would with a regular range.
I hope this helps! Let me know if you have any further questions.
Sub Example()
Dim myTable As ListObject
Set myTable = Worksheets("Sheet1").ListObjects("Table1")
Dim myColumn As Range
Set myColumn = myTable.ListColumns("Column1").Range
'Do something with myColumn
End Sub
Private Function GetValue(ByVal myRange As Excel.Range, ByVal strCol As String) As String
GetValue = myRange.Columns(myRange.ListObject.ListColumns(strCol).Range.Column).Value
End Functionhttps://superuser.com/questions/875848/referencing-cell-only-by-column-name-in-excel-2010-vba