bryanworkman
New Member
- Joined
- Oct 29, 2015
- Messages
- 6
I am very novice to VBA and table references are new to me. I have a macro that needs to go loop through every row of a table and determine the value of each cell in a specific column. That column is subject to change depending on other factors in the macro. I have a variable which captures the name of the column header that needs to be searched (colHeader) but I get an error everytime I try to use that variable in the code below. When I replace the concatenation with just the name of the column ([Tbl_BIS[Column 2]].Column) it works just fine so I'm assuming I'm concatenating wrong or this just can't work this way. Is there a simple mistake here, or is there another way to do this?
Dim rowNum as Long
Dim colHeader as String
Dim cellValue as string
rowNum = 1
colHeader = "Column 2"
cellValue = [Tbl_BIS].Cells(rowNum, "[Tbl_BIS[" & orgLevel & "]].Column")
Dim rowNum as Long
Dim colHeader as String
Dim cellValue as string
rowNum = 1
colHeader = "Column 2"
cellValue = [Tbl_BIS].Cells(rowNum, "[Tbl_BIS[" & orgLevel & "]].Column")