How I can find string in excel with vba?

Trying to find Excel VBA code for "round dot" gridline.

  • Excel VBA question: help me insert a "round dot" gridline in my chart. The following line of code inserts a dotted gridline in my chart: ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle = xlDot But if you change the gridline manually, you have two dotted line options: a faint "round dot" line and a more prominent "square dot" line. The "xlDot" choice in the code above returns the "square dot" style. I want the round dot, but none of the http://msdn.microsoft.com/en-us/library/bb241348.aspx correspond with the round dot style. How do I get that line style?

  • Answer:

    Courtest of that list, the answer seems to be: ActiveChart.Axes(xlValue).MajorGridlines.Format.Line.DashStyle = msoLineSysDot

mullacc at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

The linestyle options are just labels for integers, right? Once you've manually set the style you want, I'd try: MsgBox (ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle) to find out the value, and then set it straight to the integer, rather than the label.

pompomtom

Strangely, it returns "-4118" which is the integer for xlDot (otherwise known as the "square dot" line).

mullacc

What version of excel are you using? (guessing 2003, which I don't have handy...) I don't suppose you want to send me an example? I'm intrigued. I suspect perhaps there's another property to the border which wants setting, but the (xl2007) test workbook I have here isn't really helping.

pompomtom

I am using Excel 2007. I uploaded the example file to http://www.divshare.com/download/11097818-786.

mullacc

Ouch. I'm stumped. I've forwarded this to an excel list I recommend (see: peach.ease.lsoft.com). Perhaps the experts there can tell us...

pompomtom

Cool. Thanks.

mullacc

Winner winner.

mullacc

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.