VBA batch generate bar chart code

Source: Internet
Author: User

Sub Hong3 ()

' Macro 3 Macro D
Dim A, B as Integer
Dim Str as String
For a = 227 to 947 Step 15
b = A + 5
str = "sheet1! B "+ CStr (a) +": G "+ CStr (b)
SH = ActiveSheet.Shapes.AddChart2 (216, xlbarclustered)
Sh. Select
Activechart.setsourcedata Source:=range (str)
Activechart.setelement (Msoelementcharttitlenone)
Activechart.setelement (Msoelementprimaryvaluegridlinesnone)
Activechart.setelement (Msoelementlegendright)
Activechart.setelement (Msoelementprimaryvalueaxisnone)
Activechart.hasaxis (xlcategory) = True
With SH
. Top = Range ("J" + CSTR (A-1)). Top
. left = Range ("J" + CSTR (A-1)). Left
End with

Activechart.axes (xlcategory). Select
Selection.majortickmark = Xloutside
Activechart.setelement (Msoelementdatalabeloutsideend)
Next A
End Sub

VBA batch generate bar chart code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.