Excel 2007
VBA question
I have written a sub to fill a user-form combo box based on the content of a Excels tables header auto-filter list. When I hard code the column header name it works fine. The problem I'm having is trying to make it dynamic.
The line of code I need to be able to dynamicly change is this.
Set AllCells = Range("Table1[[#ALL],[Invoiced_By]]")
I would like to use a variable to replace the Table header name ([Invoiced_By]).
Dim Hvar as String
Hvar = Toolbar.cboList.value
Set AllCells = Range("Table1[[#ALL],Hvar]")
When I try I keep getting an error "Method Range of Object Global Failed" . I think my syntax is wrong.
Any help would be greatly appreciated
VBA question
I have written a sub to fill a user-form combo box based on the content of a Excels tables header auto-filter list. When I hard code the column header name it works fine. The problem I'm having is trying to make it dynamic.
The line of code I need to be able to dynamicly change is this.
Set AllCells = Range("Table1[[#ALL],[Invoiced_By]]")
I would like to use a variable to replace the Table header name ([Invoiced_By]).
Dim Hvar as String
Hvar = Toolbar.cboList.value
Set AllCells = Range("Table1[[#ALL],Hvar]")
When I try I keep getting an error "Method Range of Object Global Failed" . I think my syntax is wrong.
Any help would be greatly appreciated