473,382 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Trouble automating creation of charts/graphs

Hi,

I'm a newb at VBA and am having a little trouble finding help on what I'm trying to code. Would appreciate any help anyone can provide.

Basically, I am writing a macro to automate the process of creating multiple graphs. I plan to write some code (later)which will output a list of row numbers. I need this code to be able to loop through that list and create a graph for each of those rows.

I tried to define variables for the data range so that I can loop through and just change the variable, but I don't think I am doing it correctly. Any advice?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub LoudnessChart()
  3. Dim LChart As ChartObject
  4. Dim Lrange As Range
  5. Dim Lrow As String
  6. Dim Lstr As String
  7. Dim Lname As String
  8.  
  9. Lrow = 170
  10. Lstr = "Range(" & Chr(34) & "Summary!G" & Lrow & ":V" & Lrow & Chr(34) & ").Values"
  11. Set Lrange = Lstr
  12.  
  13.  
  14.  Windows("Sorted.xls").Activate
  15.     Sheets("Temp").Select
  16.     Set LChart = ActiveSheet.ChartObjects.Add _
  17.         (Left:=100, Width:=375, Top:=75, Height:=225)
  18.  '
  19.    LChart.Chart.SetSourceData Source:=Lrange
  20.     LChart.Chart.ChartType = xlColumnClustered
  21.     LChart.Chart.SeriesCollection(1).XValues = "=Summary!R3C7:R4C22"
  22.  
  23. Lname = Chr(34) & "=Summary!R" & Lrow & "C3" & Chr(34)
  24.  
  25.     LChart.Chart.SeriesCollection(1).Name = Lname
  26.        With Schart.Chart
  27.         .HasTitle = True
  28.         .ChartTitle.Characters.Text = "Power Door Lock Power  Lock Peak Sharpness"
  29.         .Axes(xlCategory).HasTitle = False
  30.         .Axes(xlCategory).TickLabelSpacing = 1
  31.         .Axes(xlCategory).TickLabels.Orientation = xlUpward
  32.         .Axes(xlValue).HasTitle = True
  33.         .Axes(xlValue).AxisTitle.Characters.Text = "Acum"
  34.         .HasLegend = False
  35.     End With
  36. End Sub
  37.  
  38.  
Apr 7 '10 #1
0 918

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: MT | last post by:
Hello Everyone: I would like to make some charts based on data I am retrieving from my DB. The charts should be things like bar-charts, pie-charts, line-graphs etc. Th charts can be in any...
1
by: dcinfinite | last post by:
hi everyone.. i have a question. is there anyway that Asp.net with vb.net is able to do/generate Graphs?charts or anything like tat?im currently creating a web based managment system, i would...
2
by: Arina Soukhoroukova | last post by:
Hello, i'm currently programming on a web application for stock data. Now i want to create very fancy ;-) stock charts images (jpegs/gifs/pneg), like line charts for stock data and bar charts for...
6
by: The Bear | last post by:
Does anyone know of a Chart or Graphs library for C# T.B.
8
by: Don Wash | last post by:
Hi There! I'm using CrystalReportsViewer control in my ASP.NET page to display the report. How do I increase the image quality of charts produced by Crystal Reports ..NET report file? Many...
0
by: Rach | last post by:
Hi, Does anyone know how to export charts/graphs from EXCEl into Powerpoint-Microsoft Charts though VBA code. I would like to import the underlying data with the chart as well. I know we can...
0
by: David Caissie | last post by:
I am trying to automate a Vb.net chart using the excel COM object. The problem occurs when trying to run the code in different systems. It is working fine under one of my computers but once i move...
4
by: ECRIA spam buffer | last post by:
Does anyone know of a tool that can facilitate the on-the-fly generation of pie charts and graphs? I know that the GD library/JpGraph can do these things, but I haven't seen any good examples; all...
4
by: Jan Danielsson | last post by:
Hello all, I have some data in a postgresql table which I view through a web interface (the web interface is written in python -- using mod_python under apache 2.2). Now I would like to...
5
by: programmerboy | last post by:
Hi, My manager wants me to create some charts and graphs for some of data we collect. I have never done it before neither on a desktop application nor web application. Do I need some special kind of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.