![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Location: mtl, canada
Posts: 160
|
how do i select every graph in every sheet of the workbook?
ie i want code that resembles: For everysheet in workbook For everygraph in sheet call myfunction() |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Sub SelectCharts() Dim Sht As Worksheet Dim Chrt As Chart '// Neede for Chart Sheet On Error Resume Next For Each Sht In ActiveWorkbook.Sheets If Err Then ActiveWorkbook.Charts.Select Else Sht.Select End If For Each Chrt In Sht.ChartObjects Chrt.Select 'Do your thing 'Do it well Next Next End Sub _________________ Kind Regards, Ivan F Moala From the City of Sails ![]() [ This Message was edited by: Ivan F Moala on 2002-05-24 21:30 ] |
|
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: May 2002
Location: mtl, canada
Posts: 160
|
Quote:
i suppose i could play with it til i get something. thanks |
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: May 2002
Location: mtl, canada
Posts: 160
|
what i would like to do is select all the graphs of my workbook and then adjust all the axes of each graph to a given scale. in other words, each graph will be scaled to a 24h period starting at a given date and ending 24 hours later. i have managed to select all the graphs (i think) now i'd like to be able to do the updating.
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: May 2002
Location: mtl, canada
Posts: 160
|
so far i have this for code:
Dim datedoub1, datedoub2 As Double Sheets("table2").Select Range("C1").Value = "2002-05-09 8:30" Range("C2").Value = "2002-05-10 7:30" Range("C1").Select Selection.NumberFormat = "General" Range("C2").Select Selection.NumberFormat = "General" datedoub1 = Range("C1").Value datedoub2 = Range("C2").Value [d1] = datedoub1 [d2] = datedoub2 Dim ofmysheet As Worksheet Dim ofmygraph As Chart On Error Resume Next For Each ofmysheet In ActiveWorkbook.Sheets If Err Then ActiveWorkbook.Charts.Select ofmysheet.Select For Each ofmygraph In ofmysheet.ChartObjects ofmygraph.Select ActiveChart.ChartArea.Select Call okay((datedoub1), (datedoub2)) Next ofmygraph Next ofmysheet the function okay() is supposed to update the axes of the graph. as so: Sub okay(mydatedoub1 As Double, mydatedoub2 As Double) With ActiveChart.Axes(xlCategory) .MinimumScale = mydatedoub1 .MaximumScale = mydatedoub2 .MinorUnit = 0.04 .MajorUnit = 0.08333333333333 .Crosses = xlCustom .CrossesAt = mydatedoub1 .ReversePlotOrder = False .ScaleType = xlLinear .DisplayUnit = xlNone End With if i send okay() just one chart, it seems to work. it's when i try the For Loops i don't think i'm sending properly selecting the charts. help? |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|