I have a table with a list of report data sources, including server name, table, fields, groupby etc... I can then select the entries I wish to refresh via Slicer and hit REFFRESH. One column has the name of the table where the data should be put, just a basic string. How can I assign that to a worksheet variable.
I get TYPE MISMATCH when using the following. x is just part of a loop that checks each row in the table to see if it is selected.
dim oLo As ListObject, cTab As Worksheet
Set cTab = wb.Sheets(oLo.DataBodyRange.Cells(x, 10))
Any ideas?
Took me 5 minutes to write the question, then I get a flash of inspiration. I just needed to add a "" &
and & ""
before/after the variable/cell reference.
Set wb = ThisWorkbook
Set ws = wb.Sheets("ADMIN")
Set oLo = ws.ListObjects(1)
For x = 1 To rCNT
'Trigger update for each visible row
If oLo.DataBodyRange.Rows(x).Hidden = False Then
cFields = oLo.DataBodyRange.Cells(x, 7)
cTable = oLo.DataBodyRange.Cells(x, 6)
cCriteria = oLo.DataBodyRange.Cells(x, 8)
cGroup = oLo.DataBodyRange.Cells(x, 9)
Set cTab = wb.Sheets(oLo.DataBodyRange.Cells(x, 10).Value)
Set cRng = cTab.Range(oLo.DataBodyRange.Cells(x, 11))
' - Call to function that refreshes the data
' - TBC
' - -------------------------------------
End If
Next x
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.