Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default VBA Needed to remove graphs

Hi all I have in a workbook vba code that creates a graph when a sheet is
activated. These happen on sheets 4 to 42. The reason I do this is to keep
the file size small as it is used on Excel 97. The problem i have is trying
to remove these graphs when the sheet deactivates due to the new sheet
activation code working. Is there a simple quick code that can remove any
graphs that are in pages 4 to 42 that I could put in say sheet activation
before the new graph code!

Hope this makes sense!

Regards
Neil



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA Needed to remove graphs

for each sh in Sheets
if sh.Index 3 then
if sh.ChartObjects.Count 0 then
sh.ChartObjects.Delete
end if
end if
Next

--
Regards,
Tom Ogilvy


"Karoo News" wrote in message
...
Hi all I have in a workbook vba code that creates a graph when a sheet is
activated. These happen on sheets 4 to 42. The reason I do this is to keep
the file size small as it is used on Excel 97. The problem i have is

trying
to remove these graphs when the sheet deactivates due to the new sheet
activation code working. Is there a simple quick code that can remove any
graphs that are in pages 4 to 42 that I could put in say sheet activation
before the new graph code!

Hope this makes sense!

Regards
Neil





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default VBA Needed to remove graphs

Hi Neil,

Assuming you want to delete all charts on any deactivated sheet, try this in
the ThisWorkbook module -

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Sh.ChartObjects.Delete
End Sub

Regards,
Peter T

"Karoo News" wrote in message
...
Hi all I have in a workbook vba code that creates a graph when a sheet is
activated. These happen on sheets 4 to 42. The reason I do this is to keep
the file size small as it is used on Excel 97. The problem i have is

trying
to remove these graphs when the sheet deactivates due to the new sheet
activation code working. Is there a simple quick code that can remove any
graphs that are in pages 4 to 42 that I could put in say sheet activation
before the new graph code!

Hope this makes sense!

Regards
Neil





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default VBA Needed to remove graphs

Check out my website for Shape Delete.
That allows you a bit of control over which Shapes are removed and which
remain.

--
Rob van Gelder - http://www.vangelder.co.nz/


"Karoo News" wrote in message
...
Hi all I have in a workbook vba code that creates a graph when a sheet is
activated. These happen on sheets 4 to 42. The reason I do this is to keep
the file size small as it is used on Excel 97. The problem i have is
trying to remove these graphs when the sheet deactivates due to the new
sheet activation code working. Is there a simple quick code that can
remove any graphs that are in pages 4 to 42 that I could put in say sheet
activation before the new graph code!

Hope this makes sense!

Regards
Neil




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP needed to remove 2nd spreadsheet within a workbook alphaewe Excel Discussion (Misc queries) 3 May 30th 10 04:49 PM
remove weekends on graphs Rick in Roanoke Excel Discussion (Misc queries) 1 September 10th 09 09:00 PM
How to Remove text values from graphs JAbels001 Excel Discussion (Misc queries) 4 May 19th 09 01:22 AM
Help needed for plotting charts/graphs xxbenxx Excel Discussion (Misc queries) 0 January 27th 06 04:44 AM
Remove single quote, help needed! Sergei[_2_] Excel Programming 1 February 12th 04 05:42 PM


All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"