Użytkownik "DCSwearingen"
napisał w
wiadomości news:DCSwearingen.2c2z66_1154804408.7466@excelforu m-nospam.com...
Is there a way to change chart parameters without actually selecting the
sheet or activating the chart?
I have about 160 individual charts on three worksheets. 
I know I can set Application.ScreenUpdating = False as a last resort.
Here is the basic structure for updating one chart's parameters.
Sub SetAxesValues()
Dim cMin, cMax
cMax = Sheets("Electric").Range("A3").Value
cMin = Sheets("Electric").Range("A4").Value
Sheets("Electric").Select
ActiveSheet.ChartObjects("PotElectRoll").Activate
With ActiveChart.Axes(xlValue)
MinimumScale = cMin
MaximumScale = cMax
MinorUnit = (cMax - cMin) / 25
MajorUnit = (cMax - cMin) / 5
End With
cMin = Sheets("Electric").Range("A5").Value
cMax = Sheets("Electric").Range("A6").Value
With ActiveChart.Axes(xlCategory)
MinimumScale = cMin
MaximumScale = cMax
End With
End Sub
Can the two lines selecting the sheet and activating the chart be
replaced by
wrapping the rest of the routine in a With / End With construction?
I just can't seem to find the syntax... The following doesn't work.
With Sheets.ChartObjects("PotElectRoll")
..
End With
--
DCSwearingen
Getting old, but love computers.
------------------------------------------------------------------------
DCSwearingen's Profile:
http://www.excelforum.com/member.php...o&userid=21506
View this thread: http://www.excelforum.com/showthread...hreadid=568668
if you want to go thru all the sheets & all charts located in there use
for each sh ns sheets
sh.activate
for each char in activesheets.chartobjects
....your code here
next
next
is that what u meant?
mcg