Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default counting rows to an empty cell and making a chart

Hi Nick -

Check out my response to your more recent post.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Nick wrote:
Jon, thank you very much. I guess I should get a bit more into VBA.
Anyways, this works very well, but I want to make some changes.
Because I always have four sets of data I would like to put them all
into one chart. As mentioned before, data look something like this:

0 98.7 1
20 99.4 1

0 98.6 2
20 98.7 2

0 98.2 3
20 99.5 3

0 97.3 4
0 98,5 4

So I changed your code into this:

"Sub MakeCharts()
Dim myCell As Range
Dim myCell2 As Range
Dim myRange As Range
Dim myChartObject As ChartObject
Dim mySeries As Series

Dim counter As Single
counter = 0

Set myCell = ActiveSheet.Cells(1, 1)
Debug.Print myCell.Address
If Len(myCell.Text) = 0 Then
Set myCell = myCell.End(xlDown)
Debug.Print myCell.Address
End If

Do

Set myChartObject = ActiveSheet.ChartObjects.Add _
(myCell.Offset(0, 3).Left, myCell.Top, 350, 275)

Do While counter < 4

Set myCell2 = myCell.End(xlDown)
Set myRange = ActiveSheet.Range(myCell, myCell2)

Set mySeries = myChartObject.Chart.SeriesCollection.NewSeries
With mySeries

.Values = myRange.Offset(0, 1)
.XValues = myRange
.Name = "=" & myRange.Offset(0, 2).Resize(1, 1).Address _
(ReferenceStyle:=xlR1C1, external:=True)
.ChartType = xlXYScatterSmooth

End With


Set myCell = myCell2.End(xlDown)
Debug.Print myCell.Address

counter = counter + 1

Loop


Loop Until myCell.Row = 65536

End Sub "


And this works fine as long as I only make one chart. After that the
program is stuck. Any idea why?
And I also had an other question. How can I give a name to the chart?
Something like:

With ActiveChart
..HasTitle = True
..ChartTitle.Text = "Blabla"
End With

doesn't work.

Thanx in advance.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a cell empty JoeP Excel Discussion (Misc queries) 3 November 19th 08 06:23 PM
Making a cell blank or empty without deleting it Brunner New Users to Excel 1 December 18th 06 10:44 PM
How can Excel make a cell empty without making it na()? Bruce Excel Discussion (Misc queries) 1 June 27th 06 09:31 AM
Function making cell really "empty" Arvi Laanemets Excel Worksheet Functions 2 January 31st 05 05:23 PM
counting non-empty rows in a column Fede Querio Excel Programming 1 July 19th 03 05:57 PM


All times are GMT +1. The time now is 11:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"