I try to select multiple columns out of a named range. I build the string what should be selected with some variables:
Dim onecolumn as Integer, lastcolumn as Integer
Dim tblTable as ListObject
Dim strforrange as String
Set tblTable = Sheet1.ListObjects("Table1")
onecolumn = 3
lastcolumn = tblTable.Range.Columns.Count
strforrange = tblTable & "[[#All],[Column" & onecolumn & "]:[Column" & lastcolumn - 1 & "]]"
Range(strforrange).Select
I ran the code step-by-step and checked the "strforrange" variable. Even when it's correct the selected columns differ from the ones stated in the string.
Is there any other way to get the range of a named table or does someone know a solution for this?