Hi,
I am having workbook with 10-12 sheets, each containing 3-4 charts. I have chart name but not the associated sheet name. Do we have a direct function to find the worksheet name associated with chart?? Right now i am using below mentioned solution:
Code:
Function ReturnSheetNameOfChart(ChartName As String) As String
Dim cht As Chart
Dim sh As Worksheet
Dim strWbkName As String
For Each sh In ThisWorkbook.Sheets
On Error Resume Next
Set cht = sh.ChartObjects(ChartName).Chart
If Err.Number = 0 Then strWbkName = strWbkName & sh.Name & ","
Err.Clear: On Error GoTo 0
Next
ReturnSheetNameOfChart = Left(strWbkName, Len(strWbkName) - 1)
End Function
Any better and fast solution because this is timetaking to scan through each sheet.
Bookmarks