so here is what I have (graphs), and it is not working:
Dim cobj As ChartObject
For Each cobj In ActiveSheet.ChartObjects
ActiveChart.Axes(xlValue, xlPrimary).Select
Selection.TickLabels.NumberFormat = "#,##0.0_);[Red](#,##0.0)"
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue, xlSecondary).Select
Selection.TickLabels.NumberFormat = "#,##0_);[Red](#,##0)"
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
Next cobj
End Sub
again, however, my ideal scenario is not to have the macro go automatically
through each chart. Rather, I have some sheets where I need it just to go
through all, make changes I indicate, and then be done with the sheet.
but other sheets, I actually would prefer to go one by one, however not
having to hold the mouse and click on each successive graph. I want to
assign a shortcut key to run (I'll select the first graph), and end with a
line that basically does the same as simply clicking on the next graph (but
not running the macro over (which I understand for-each will force it to do).
Then once it's selected the next graph, I'll again hit the shortcut if I'm
sure I want to run it on that graph.
Thx for any further help.
--
Boris
xlbo said:
The exact syntax will depend on the objects you are trying to llop through
but essentially you need a For Each..Next loop through the object collection
so
For each objectVariable in SheetRef.objectCollection
Process objectVariable
Next
so to iterate through the textboxes on a sheet, you would reference the
SHAPES collection:
For Each shp In ActiveSheet.Shapes
MsgBox shp.Name
Next
--
Rgds, Geoff
:
I need for a macro to run and then have the next object selected. What is
the one line that will get me that "select next object in the sheet" code? I
don't want it to go through all of them, just to do the equivalent of
clicking on the next graph I have in number order.
Thx.