excel - Removing Gridlines in All Charts on All Worksheets -


i'm working following code:

sub removegridlines()  dim axs axes dim ws worksheet dim objcht chartobject  each ws in worksheets         ws.activate         each objcht in ws.chartobjects             objcht.chart                 each axs in objcht.chart                     .axes.hasmajorgridlines = false                     .axes.hasminorgridlines = false                 next axs             end         next objcht next ws  end sub 

and hung on for each axs in objcht.chart object mismatch. tried adding .axes line won't proceed regardless. how can loop through each axis, chart, , worksheet? when remove.chart , remove .axes subsequent lines method or data member not found.

you know, funny real reason, code works:

sub removegridlines2()      dim axs             axis     dim ws              worksheet     dim objcht          chartobject     dim k               chart      each ws in worksheets         each objcht in ws.chartobjects             set k = sheets(ws.name).chartobjects(objcht.name).chart             each axs in k.axes                 axs.hasmajorgridlines = false                 axs.hasminorgridlines = false             next             set k = nothing         next objcht     next ws  end sub 

actually, if change "axes" "axis" in code in "dim" may working code :) enjoy it! :d

edit: , how code should like:

sub removegridlines()      dim axs                 axis     dim ws                  worksheet     dim objcht              chartobject      each ws in worksheets         ws.activate         each objcht in ws.chartobjects             each axs in objcht.chart.axes                 axs.hasmajorgridlines = false                 axs.hasminorgridlines = false             next axs         next objcht     next ws  end sub 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -