Results 1 to 2 of 2

Thread: Find Chart's Parent worksheet with given chart name

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0

    Find Chart's Parent worksheet with given chart name

    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.
    Last edited by littleiitin; 11-30-2012 at 09:19 AM. Reason: wrong words written

  2. #2
    Member littleiitin's Avatar
    Join Date
    Aug 2011
    Posts
    90
    Rep Power
    14
    Hi SP69,

    if you have chart name only and you want to get the worksheet name then only way is to navigate through all the sheets which you already did.

    Thanks

Similar Threads

  1. Replies: 2
    Last Post: 05-26-2013, 03:41 PM
  2. Excel Chart Showing Values on Angle: Nightingale Chart
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 0
    Last Post: 10-17-2012, 06:39 PM
  3. Replies: 1
    Last Post: 05-20-2012, 12:23 PM
  4. 2007 PPT Chart Data is not Reflecting In Chart
    By littleiitin in forum Powerpoint Help
    Replies: 2
    Last Post: 04-28-2012, 01:42 PM
  5. Find Parent Folder From Given Folder / File Path
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 05-28-2011, 03:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •