How To Draw A Chart Using Data From Database?
my database file contains a table, how can i draw a chart using the data from the table in the database?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
USing Data To Draw Org Chart
apologies if this has been posted before.
I have a data structure in access, 2 tables, one detailing forms from a 3rd party application, name and title, the other showing the parent child relationships.
I wanted to quickly download an application which would read in these data and draw me an org chart so that we can see the menu structure for testing purposes. (there are 1000's of forms so doing this manually is not an option).
On failing to find anything through google i decided to record some power point macro's whilst inserting an Org chart, changing text, adding nodes etc.
The code I recorded is horrible to read, where i entered data in 3 branches it all appears in the code as one string.
So i tried in excel, with which i am more familiar with VBA, and in excel XP you cannot perform any org chart actions while recording a macro.
so can anybody help me learn to manipulate an org chart object through VB, to send it the data i want it to draw
macro code: i inserted a chart, and entered "Top" in the top level, one, two and three in the 2nd tier and i added a node under three and added "three_1"
Code:
ActiveWindow.Selection.SlideRange.Shapes("Group 5").Select
ActiveWindow.Selection.ShapeRange.GroupItems(Index:=10).TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "three_1threetwoonetop"
With .Font
.Name = "Arial"
.Size = 18
.Bold = msoFalse
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppForeground
End With
End With
ActiveWindow.Selection.SlideRange.Shapes("Organization Chart 5").Select
its this bit which confused me:
.Text = "three_1threetwoonetop"
i suppose in the worst case scenario i could do this with a txt string converting the data to a HTML table but would I prefer a nice easy and elegant solution.
Using Data From A Database To Draw Graphs Using MSChart
Hi,
I'm very new to visual basic and have come a bit unstuck with using MSChart.
I have set up a database, which I am using to draw a graph with MSChart. The data is displaying on the graph, but not in the correct format. I am unable to plot sets of data against one another, all the data from the database just gets plotted against visual basic's pre defined axis. What I really want to do is plot value against the year that value occurred, but what I am getting is one continuous plot of all the years and values.
I think I need to declare something against the record set so that I am defining the X-axis and then y-axis and then some sort of loop to move through the points? But I'm not really sure how to do this can anyone help? Please!
Zoë
This is the code I've got so far
Private Sub cmdGraph_Click()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim strProvider As String
Dim strDataSource As String
Dim strSQL As String
strProvider = "Microsoft.Jet.OLEDB.3.51"
strDataSource = "C:My DocumentsOEPensions.mdb"
strSQL = "SELECT Year, Pensioners FROM Pensions"
cnn.Open "provider=" & strProvider & ";Data Source=" & strDataSource
rst.Open strSQL, cnn, adOpenStatic
With MSChart1
Set .DataSource = rst
.ShowLegend = True
.chartType = VtChChartType2dLine
End With
End Sub
Using Data From A Database To Draw Graphs With MSChart
Hi,
I'm very new to visual basic and have come a bit unstuck with using MSChart.
I hope this makes sense!
I have set up a database, which I am using to draw a graph with MSChart. The data is displaying on the graph, but not in the correct format. I am unable to plot sets of data against one another, all the data from the database just gets plotted against visual basic's pre defined axis. What I really want to do is plot value against the year that value occurred, but what I am getting is one continuous plot of all the years and values.
I think I need to declare something against the record set so that I am defining the X-axis and then y-axis and then some sort of loop to move through the points? But I'm not really sure how to do this can anyone help? Please!
Zoë
Creating A Pie Chart From Data In An Access Database
I have my access database connected to the chart, however I would like my chart to be a pie chart that takes the sales amount for each person and makes them a slice of the pie. Not sure how to set the pie chart to make it work. I currently get a single pie for each person I have. Can anyone help?
This is my database.
name Amount
Sam 3000
Bill 4000
dave 2500
ken 5000
chris 6000
Draw Chart And Db Design
Using the tutorial from this site, I made a simple chess rating calculator. Question:
1. After typing "a" to search for Hafiz Shafruddin for example, a list of names with letter "a" will appear on the combobox. How can I make player's rating textbox automatically filled with 2100 when I double click/single click "Hafiz Shafruddin"? (read from the database)
2. I wanted to make a player's graph performance.
How do I design the database so that there will be records of each player's rating for a given date? Then, how to draw a graph rating fluctuations of the last 10 games for a player?
How I Can Draw A Curve With Ms Chart Control In Vb6
i need help for the drawing curve with the ms chart control with five points and also i want to calculate the intersection point of the two different curve.
plz help me how to use ms chart control in my vb application. i haven't use ms chart control before.
How To Draw On One Chart, Line And Histogram???
Hello i have a simple question, i want to draw on one chart two series,
or in other word two lines.
Then after the user press on a button, I want that one line will convert to 2dbar or any other possible like 3darea and so one.
I found out that there is a code for controlling the series and like you can change the chart type with the code:
MSChart1.chartType = VtChChartType3dStep
you can change the series with the code
MSChart1.Plot.SeriesCollection(Series).SeriesType = VtChSeriesType2dBar
the only problem is that its not working
how then can it be done?
janiv
Draw A Horisontal Line In Excel Chart With Only One Column
I'm trying to draw a horisontal line in an excel ColumnClustered chart and this works fine, except for the case where there is only one column. Logical, I know. It's difficult to draw a line based on only one point. Any ideas on how to get around this?
Public gChartObject As Excel.ChartObject
Private Sub fixthegraph(ByVal excelrange As String, ByVal timeInterval As Integer, ByVal timeType As String)
Dim i As Integer
Dim myAxis As Axis
Dim range As String
'fix range
range = "a1:" & excelrange & "5"
gChartObject.Name = "Result"
For i = 2 To 5
gChartObject.Chart.SeriesCollection.Add source:=gXlDataSheet.range("a" & i & ":" & excelrange & i)
Next i
gChartObject.Chart.SeriesCollection(1).XValues = gXlDataSheet.range("b1:" & excelrange & "1")
gChartObject.Chart.ChartType = xlLine
gChartObject.Chart.HasDataTable = True
gChartObject.Chart.HasLegend = False
gChartObject.Chart.SeriesCollection(1).ChartType = xlColumnClustered
If frmMain.lstChosenAreas.ListCount < 2 Then
' only show target line (red) if one chosen area...
gChartObject.Chart.SeriesCollection(3).Border.Color = RGB(255, 0, 0)
gChartObject.Chart.SeriesCollection(3).Border.Weight = xlThick
' ??????? what to do if only ONE column???????
Else
' hide da line, aiiight?
gChartObject.Chart.SeriesCollection(3).Border.Color = RGB(0, 0, 0)
gChartObject.Chart.SeriesCollection(3).Border.Weight = xlHairline
End If
gChartObject.Chart.SeriesCollection(4).Border.ColorIndex = xlColorIndexNone
gChartObject.Chart.SeriesCollection(2).Border.ColorIndex = xlColorIndexNone
'do some stuff...
' now, copy chart to clipboard
gChartObject.Chart.CopyPicture
' and paste it to the form
Me.Picture = Clipboard.GetData
Me.Show
Screen.MousePointer = vbNormal
End Sub
Edited by - agyl on 5/3/2004 2:24:12 AM
Draw Order For Database Saved Graphical Objects
Hi all,
I have a need to save different graphics items (shapes, labels, picture box's - that sort of thing) that are populating a master picturebox to a database. The idea being that different graphics sets can be called on demand from the database from a drop down list.
When I am re-creating the drawing I need to get my z-order right so that the picture builds up correctly where objects overlap.
Is there any way of accessing this information from the master picture box or do I have to get creative with the information I leave in the .Tag properties?
Thanks in advance
David
Draw Graphs With Refering The Information From Access Database
Hi.....
I'm facing a problem about drawing graph ( for example pie chart and histogram ) by refering the information provided from the Access Database.
Can anyone please teach me and guide me how to make it ?
I would be grateful if someone can reply me .......
Thanks a lot....
Regards,
Deimy
Load Database To Combobox And Draw Line With The Selection Made By User
Hi everyone
I am trying to create a programm for my university and i need yor help. I want to load a database into a combobox and then with the selection that i will make, i want a line to be drawn in the screen. Let my explain that better...(using VB 6 and ACCESS database)
I have an Access database with 2 fields. Let's named them A,T. I want these to fields to be loaded to the 2 comboboxes that i have in my form, combobox1, combobox2. When the data will be loaded to the comboboxes (A to combobox1, T to combobox2), i want to select one element from the combobox1 and one from the combobox2. Let's say cmb1 contains A, B, C, D, and cmb2 contains the same. When i select A and B from then cmbs i want a line to be drawn in an image already loaded in my form. If i select B and C to connect them with a line in the image etc. the image already contains A,B,C,D. what i want is to connect them (the selection that i make) with a line...
If you do not undertand something of my post just let me know, to explain it better. I am a newbie in programming,so plz explain and if you can provide me with the source code.
I have managed to load the database into my two comboboxes! Because the 2 fields in my databases are the same, i want when the user chooses the same data in the two comboboxes, a message to be displayed, so the user change his selection. Any idea how to do that??? And how to draw the line in the picture???
---------------------------------------
CODE
----------------------------------------
VB Code:
Option Explicit'Connection and recordset objectsDim con As ADODB.ConnectionDim rs As ADODB.Recordset'A string to store the access statementDim stracc As String Private Sub Form_Load()Dim strSearchCriteria As StringDim DataPath As StringDim arxh As StringDim combo1 As String'Instantiate recordset and connectionSet con = New ADODB.ConnectionSet rs = New ADODB.Recordset DataPath = App.Path + "dbst.mdb"con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DataPath + ";Persist Security Info=False;" ' Select the data.rs.Open "select * from sta8moi", con, adOpenKeyset, adLockOptimisticrs.MoveFirst Do While Not rs.EOFMe.combo1.AddItem (rs![A])Me.Combo2.AddItem (rs![T])rs.MoveNextLoop ' Close the recordset and connection.rs.Closecon.Close End Sub
Me Again - Chart With Database
Once again, the form ive lost had all this in, and I cant remember how I got it to work, but it work pretty easy, if I remember right. Ive searched the forum, and all results involve something different that ive done. I am using the Chart control in VB 6, and am pulling all data from a Table (Access). There is two entries, date, and the value. I want the chart to "draw" itself with the date on the bottom, and its corresponding value on the other axis. The only help I need is what needs to be set on my graph, so that when I do a MsChart1.refresh, it pulls all my data on lets say Adodc1. Lets say the fields are called "DateTime" and "Value"?
Once again, thanks for the help!!
Attach A Chart To My Database???
I dont mean to rush anyone. I have states comming up shortly. I took second in Visual Basic in Regionals. But anyways to get to my question.
In states they are requiring I add a chart to a database... Well even my teacher is struggling with what they want exactly so I figure maybe some here could help... So my question is... How do I attach a chart to my database... Any and all replies would be helpful... Thank you...
Your Computer Idiot
Lost Caust
Help With Chart Linked To Database
Good morning:
I need to link a chart to a database.
For the purposes of this question, we'll call it an Access 2000 DB.
I have created a form with an ActiveX Data component that already connects
to the Access 2000 DB.
Now I need some sort of ActiveX chart component that will display data from
a query in the database.
Does anyone know of any component that is compatible with this? If so, what
component is it and how do I set the values?
Thanks in advance.
Brian Rollins
TransCore Commercial Services, Inc.
503-643-4331 x4742
Chart Only Some Data
Hello All, I have a spreadsheet with data running horizontally. I have buttons to the left of the data to hide the data. The buttons just change the font color to be the same as the background color. We use this to show people only some of the data. What I would like to be able to do is graph only the data that is visible. Any help would be appreciated or just head me in the right direction.
Thanks
Andrew
Two Data In One Chart
I have two data will show on the list1 and list2,I want to use these two data draw mschart.
Here are my code
Code:
Dim i As Integer, j As Integer, k As Integer, l As Integer
Dim plotArr(0 To 10, 0 To 1) As Variant
Dim inp As Integer
If List1.ListCount >= 10 Then List1.RemoveItem 0
List1.AddItem Val(Lbpv1.Caption)
For i = inp To inp + 10
plotArr(j, 0) = "b" & CStr(i)
plotArr(j, 1) = List1.List(i - inp)
j = j + 1
Next
inp = inp + 1
With MSChart1
.Column = 1
.ColumnCount = 2
.RowCount = 10
.ChartData = plotArr
End With
If List3.ListCount >= 10 Then List3.RemoveItem 0
List3.AddItem Val(Lbsp1.Caption)
For k = inp To inp + 10
plotArr(l, 0) = "b" & CStr(k)
plotArr(l, 1) = List3.List(k - inp)
l = l + 1
Next
inp = inp + 1
With MSChart1
.Column = 2
.ColumnCount = 2
.RowCount = 10
.ChartData = plotArr
End With
Lists have no problems,but the error in "column = 2".
Could someone solve my problem? Thank you very much......
Set Chart Data
Hello
my problem is to set another datapoints on the mschart but which is not used in the drawing on the chart, what can i do?. i hope u can understand my question!!!! i do not care about marker here
thanks for advice
if u do not understand my question,please tell me to explain it again to you.
Egyptian Man
Chart Source Data
Is it possible to set the source data of a chart to an external reference / workbook. I have tried the following but to no avail:
Activechart.SetSourceData Source:=Workbooks(FilepathWorkbookName.xls).Sheets ("Data").Range ("A1:Z1"), PlotBy:= xlrows
Can anyone help ?
Chart Data Manipulation
Hello All,
I've noticed that the charts in Excel allow the user to move the data points, thus changing the data points (so long as they are not formulas). I tried to add the Microsoft Chart version 11 control to a form in VBA, but when the form is loaded, it doesn't seem to be possible to move the points. Is there any way of implementing a chart so that the user changes the data points by dragging?
Also, I can't find the datagrid control in VBA, though it avaiable in .NET. Where is it?
Thanks
Any Way To Extract The Data From A Chart?
I have a chart in ppt, I would like to extract the values form the chart and place them into a spread sheet. I have everything down except, how would I go about extracting the data elements from the chart?
Pull Data In Chart
URGENT!!
Just wrote a macro that
1) deletes the existing column chart
2) creates a new chart with one data entry
3) updates the chart by pulling additional input data into the chart. Both the chart and the input data are located on the same sheet.
The program is running.
If I want to apply the same macro on a different sheet in the same workbook by only adjusting some data ranges and sheet/workbook names a weird error occurs:
"Run-time error '5': Invalid procedure call or argument"
The debugger flags the following line of the source code:
ActiveChart.Location Where:=xlLocationAsObject, Name:="Total Amount of Claims per Year"
Despite the above line, the new chart is inserted on a new sheet. It should be inserted on the same sheet that contains the input data. Do I have to put in "other words". It seems that there is no logical and semantically mistake.
Here is a part of the source code including the critical line:
'create chart
Range("A1").Select
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Total Amount of Claims per Year").Range("B2"), PlotBy:= _
xlRows
ActiveChart.SeriesCollection(1).XValues = "='Total Amount of Claims per Year'!R1C2"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Total Amount of Claims per Year"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Total Amount of Claims per Year"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
I appreciate any advice or question as this is a really urgent project.
Thank you.
Extrapolating Data From A Chart
Hi,
I need help in extrapolating data from varying XYScatterline curves generated in charts I created. For example, on my y-axis is probability an event will occur and my x-axis is vehicle speed. I need to extrapolate the vehicle speed value at the 70%, or .70, probability line the event will occur. Is there a way to program this being that the data points in my range of my chart may not be equal to .70 but the curves generated cross the .70 line? I would truly appreciate any help! Thank you!
Take Data And Create Pie Chart?
My code is pretty good so far with what I'm trying to do, but now I would like to take the data I'm sending to excel and create a pie chart on the worksheet to give a graphical representation of how time is spent.
The code dumps 3 values out into 3 colums... Hour, Minute, and Second
How can I create a pie chart in VB to do this?
My code so far is:
Code:
Private Sub Command4_Click()
If Command1.Caption = "Start" Then
Dim oExcel As Excel.Application
Dim oWB As Excel.Workbook
Dim oWS As Excel.Worksheet
Set oExcel = New Excel.Application
Set oWB = oExcel.Workbooks.Add
Set oWS = oExcel.ActiveSheet
oExcel.Visible = False
oExcel.DisplayAlerts = False
oWS.Cells(1, 1) = "Total Time in Production"
oWS.Cells(1, 2) = Hour(TotalInterval1) & " Hours"
oWS.Cells(1, 3) = Minute(TotalInterval1) & " Minutes"
oWS.Cells(1, 4) = Second(TotalInterval1) & " Seconds"
oWS.Cells(2, 1) = "Total Time in Scrap"
oWS.Cells(2, 2) = Hour(TotalInterval1) & " Hours"
oWS.Cells(2, 3) = Minute(TotalInterval1) & " Minutes"
oWS.Cells(2, 4) = Second(TotalInterval1) & " Seconds"
oWS.Cells(3, 1) = "Total Time Purging"
oWS.Cells(3, 2) = Hour(TotalInterval1) & " Hours"
oWS.Cells(3, 3) = Minute(TotalInterval1) & " Minutes"
oWS.Cells(3, 4) = Second(TotalInterval1) & " Seconds"
'Cleanup
On Error Resume Next
oExcel.DisplayAlerts = False
oWS.SaveAs "C:Test" & Month(Date) & Day(Date) & Year(Date)
Call oWB.Close(SaveChanges:=False)
Set oWB = Nothing
oExcel.Quit
Set oExcel = Nothing
Else
MsgBox "You must stop the program before saving data."
End If
End Sub
Create Pdf Chart With DB Data
Hello, anyone know of a component i can use to create PDF line charts with data from a DB?
Right now i can create an image (.png,.jpg,etc...) file from a charting tool and then, i can embed that into a pdf with some pdf software out there.
But i would like to get rid of the part where i create the image file. I would like to grab the data from the DB and stream it to a pdf component that will directly chart the line chart in pdf.
Thanks!
laura
Data Labels On Pie Chart
I am creating an add-in that will generate pie charts automatically.
Each cell among the range used to build the chart has a title in the cell immediately above it. I would like to label the pie chart with these labels. I would prefer to use the Legend. But I'm not sure how to do this. Thanks in advance.
Chart Data = 0 = Problems
I'm having strange problems when working with mschart : if the data is 0 it shows up the following error message "bad function argument". But in other programs i did, it had 0 datas but it worked.
Maybe i'm missing some property ?
Thanks for helping !
Create Pdf Chart With DB Data
Hello, anyone know of a component i can use to create PDF line charts with data from a DB?
Right now i can create an image (.png,.jpg,etc...) file from a charting tool and then, i can embed that into a pdf with some pdf software out there.
But i would like to get rid of the part where i create the image file. I would like to grab the data from the DB and stream it to a pdf component that will directly chart the line chart in pdf.
Thanks!
laura
Column Of Data To Chart
Hello
I'm trying to send a column of data from a flexgrid to MSChart to plot. But, with this code all I get is the last entry of the first column. This number is the same across the chart x-axis. So the chart has a straight line left to right.
I wanted all the values of the single column plotted. My chart has years as the x-axis and amount as the y-axis.
Code:
For iRowCount = 1 To tempview1.MSFlexGrid1.Rows - 3
For iColumnCount = 1 To 12
' assign a FlexGrid cell's data to dCurrData
dCurrData = tempview1.MSFlexGrid1.TextMatrix(iRowCount, iColumnCount) ' replace this line?
With MSChart1
.ColumnCount = 1
.Column = iColumnCount
.Row = iRowCount
.RowCount = tempview1.MSFlexGrid1.Rows -2
.Column = iColumnCount
.Data = dCurrData
.enabled = True
End With
Next iColumnCount
Next iRowCount
Data Flexgrid To Chart
How do I put the data of a flexgrid into a chart..
searched but didn't found anything...
Pivot Chart Data
I apolgize in advance for the following question.
I have an error in all my Excel pivot tables that started 8/6/05 for no apparent reason:
"Client Safety Options do not allow pass through statements to be issued to the data source"
I have been designing and running these OLAP cubes for alomst a year and just got this error. A search of the web found a thread here somewhere but I can't find it.
Any pointers? Please.
Column Of Data To Chart
Hello
I'm trying to send a column of data to MSChart to plot. But, with this code all I get is the last entry of the first column. This number is the same across the chart x-axis. So the chart has a straight line left to right.
I wanted all the values of the single column plotted. My chart has years as the x-axis and amount as the y-axis.
Code:
iRowCount = 1 to tempview1.MSFlexGrid1.Rows - 2
For iColumnCount = 1 To 12
For iRowCount = 1 To tempview1.MSFlexGrid1.Rows - 3
' assign a FlexGrid cell's data to dCurrData
dCurrData = tempview1.MSFlexGrid1.TextMatrix(iRowCount, iColumnCount)
With MSChart1
.ColumnCount = 1
.Column = iColumnCount
.Row = iRowCount
.RowCount = tempview1.MSFlexGrid1.Rows -2
.Column = iColumnCount
.Data = dCurrData
.enabled = True
End With
Next iColumnCount
Next iRowCount
Edited by - codeblue on 9/17/2005 12:35:49 PM
Chart From ListBox Data
Hello all! I would like to create a chart into a VB .NET application by taking the data from a ListBox. Please help!!!
Thank you
Data Report And Chart
I want to show some data from the database in the form of charts in data report.
There seems to be no control avilable for doing so in data report designer at design time!
Is There any way how I can overcome this problem?
Is it possible to use Crystal Reports' tools in VB without installing it?
Reply.
This is a bit urgent.
Data In PowerPoint Chart Disappears
I do quite a lot of automation of graphs in PowerPoint from Excel. Occasionally, a chart will look like it has the correct data in, but when you double-click into it, the data reverts back to what was originally in the PPT chart (prior to automation).
I can't really attach my code because it is part of quite a large app. However, the following shows how I am referencing the PowerPoint objects:
Code:
Dim oActiveSlide As PowerPoint.Slide
Dim oObject As Object
Dim oDataSheet As Object
'set reference to graph object and datasheet
Set oObject = oActiveSlide.Shapes(MyShapeName).OLEFormat.Object
Set oDataSheet = oObject.Application.DataSheet
'put data into datasheet
oDataSheet.Cells(2, 2).Value = "2"
'...etc
oObject.Application.Update
oObject.Application.Quit
I am using version 10 of Excel and PowerPoint. Back when we first got version 10 we had a similar problem, but it appeared to be fixed by using Application.Update & Application.Quit after putting data into the chart.
Although this problem only happens occasionally, it seems to be "random" - I can't see any pattern to when it happens, and it is not replicable. Has anyone else come across this problem?
Thanks.
Excel Data Into Chart, Confusing?
I have three forms, each assigned a worksheet of a workbook. A button (Graph1) on each form reads the data from the required sheet and plots it with a minimum and max values (also in the sheet). Three other buttons allow the user to flick between each form (ie Form1, Form2, Form3.) If I am in Form1 I can see the chart and the plotted graph. If I click to go to Form2 and click Graph1 all the data changes (max and min values, chart headings, legends as it should etc) BUT it still plots the data range from the Form1 graph. Why?
Is there anyway to clear the data from the Form1 graph when going to Form2?
Cheers for any help.
Extract Data From An Excel 3D Chart
Hi,
I'm using an Excel 3D chart to display my series of data (which are very classical, each buble is a serie composed of: Name - X - Y - Bubble Size).
When I display this chart, I would like to be able to open a small window (message box, userform?) when I click on a bubble.
This small window must contain informations about the Name of the clicked serie and "external" datas (which are not related to the chart serie but to a specific cell).
Do you have any idea ?
THX
Excel Chart Data Range
I have a spreadsheet with data in Column A and I chart that data. Does anyone know how to make it so that chart will adjust the data range to compensate when more or less data is in the column?
Importing Data Into An Excel Chart
Hi All,
I have inserted an Excel chart into my user interface and have configured it to show X Y data. Can anybody tell me which commands or properties must be used to import data I have just acquired and written to an Excel file and to update the chart.
I am not a complete beginner but I have had no success with this up to now. OLE is new to me.
Would be very grateful.
Data Analysis And Chart Production
Hi i have a workbook containing five sheets, one of the sheets called enquires contains all of the enquires taken by the company and contains columns such as customer name, customer reference, quote etc.
One column in particular is called "Period Quoted" and is an integer value from 1 - 12 depending on what month the record was added. Each row represents a new quote or record.
Now what I would like to do is reference this column and go through each row recording the number of each period (i.e record the total number of 1's, 2's,3's.... and add the final results into a bar chart, with a bar for each period showing the totals.
Ive tried coming up with some pseudocode.
Select colum i
loop while row is not empty
if value = 1 then one_total = one_total + 1
if value = 2 then two_total = two_total + 1
And so on
End loop
Populate bar chart using relevant values.
Am I on the right track?
And if so, how do I loop through column i until I get to the end (i.e an empty row)?
I also dont know how to create a chart but I think I should concentrate on the code to extract the totals first.
Any help would be appreciated, Thanks Ryan.
How To Get A Chart's Source Data Range?
I want to be able to select a chart and run a macro which would refer to some data adjacent to the source data (to colour the bars appropriately). So I need to get the source data range. I can get the data values, but not the range. Can anyone help?
Excel Chart Source Data
Hi, I have a macro that does a number of things quite happily. From the completed data I have a chart which up until now I have been amending manually to allow for the increased size of the source data.
I want to amend the macro to automatically increase the size of the source data area covered as the size of the source data increases.
Using this forum and Excel help files I've added the SetSourceData method, the following works perfectly well with a defined cell range:
Charts(1).SetSourceData Source:=Sheets(1).Range("a1:a10"), PlotBy:=xlColumns
I need the second cell range (a10) to be set by a variable so that it can increment but can not get it to work. I get all sorts of error messages. The "cellref" variable is built quite happily using a variant type but I can not get it to work within the SetSourceData method.
Charts(1).SetSourceData Source:=Sheets(1).Range("a1:cellref"), PlotBy:=xlColumns
Any help is appreciated.
Bolding Data In An Pivot Chart
Hi,
I have written vb code to generate a pivot chart from data collected over several years ('99-'07).
This chart shows the change of business expenses over the time period.
I would like to black and heavily weight the most recent year (in this case '07, but this will change with each new year), so that it stands out.
I have used the macro recorder to do this but am worried, once '08 starts, the code will not know to recognize the new year. It will continue to black and heavily weight '07 but i need it to black and heavily weight the most recent year ('08).
I really am stuck and would appreciate any thoughts or ideas. As I mentioned above i've tried the macro recorder but i think the vb needs to be advanced and i'm not sure how to solve this problem.
Thanks very much.
|