I have:
Dim xlBook as Workbook
Dim xlSheet as Worksheet
Dim xlTable as ListObject
Dim xlTable Column as ListColumn
Dim xlChartObject as ChartObject
Dim xlTableObject as ListObject
Dim ObjectArray() as String
Dim ObjectIndexArray as Integer
'set the book'
Set xlBook = ThisWorkbook
'loop through each worksheet'
For each xlSheet in XlBook.Worksheets
'if we have charts
if xlSheet.ChartObjects.Count > 0 then
'grab each name
For each xlChartObject in xlSheet.ChartObjects
'update count
ObjectArrayIndex = ObjectArrayIndex + 1
ReDim Preserve ObjectArray(ObjectArrayIndex)
'add chart object to array
ObjectArray(ObjectArrayIndex) = xlChartObject.Name & "-" & xlSheet.Name & "-" & TypeName(xlChartObject)
'grab sheet
set xlSheet = xlBook.Worksheets("Export")
'grab table from sheet
set xlTable = xlSheet.ListObjects("ExportToPowerPoint")
'grab object column from table
Set xlTableColumn = xlTable.ListColumns("Object")
'set validation dropdown
With xlTableColumn.DataBodyRange.Validation
'delete old
.delete
'add new data
.add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=Join(ObjectArray, "-")
'make sure its a dropdown
.InCellDropdown = true
end with
end sub
This code works well for grabbing charts, and similarly I utilized ListObject in order to then grab tables as well.
My Issue comes with creating another block of code to grab named ranges in excel. So not Tables or Charts
Any help would be greatly appreciated!