Solved

Creating a simple barChart using current region

Posted on 2014-02-11
2
146 Views
Last Modified: 2014-02-12
Dear Experts:

I would like to create a bar chart using VBA with the following requirements

The range is to be the current region (starting from range("C2"))

The Chart is to be a bar chart (xlBarClustered) to be placed on the currently active sheet

No major gridlines on the value axis, no MajorTickMarks on the Category Axis.

No legend

Help is very much appreciated.

Thank you very much in advance.  

Regards, Andreas
0
Comment
Question by:AndreasHermle
2 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39850807
HI,

Wihtout more detail I'm stuck with that

Sub Macro1()
'

    Set shp = ActiveSheet.Shapes.AddChart
    shp.Chart.ChartType = xlBarClustered

    shp.Chart.SetSourceData Source:=Range("Sheet1!" & Range("C2").CurrentRegion.Address)
    shp.Chart.Axes(xlValue).MajorGridlines.Format.Line.Visible = msoFalse
    shp.Chart.Axes(xlValue).MajorTickMark = xlNone

End Sub

Open in new window

Regards
0
 

Author Closing Comment

by:AndreasHermle
ID: 39853679
HI Rgonzo:

this did the trick, thank you very much for your great help. I really appreciate it.

Regards, Andreas
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now