Tracker
 ASP PHP JavaScripts MySQL MS Access MSSQL VISUAL BASIC Subjects/Titles Post Text/Content
HOME    TRACKER    Visual Basic

# Fibonacci Series

## hello ive been programming in vb for about 18 weeks now and i need alot of help on the fibonacci series. i coded it in a do while, but i cant figure it out to make it into a for..next or anything else. this is what i have codedCode:Private Sub cmd1_Click()Dim x As Integer, y As Integer, temp As Integer' first terms in the fibonacci seriesx = 1y = 1picfib.Clspicfib.Print "fib series first term:"picfib.Print x;Do While y <= 100picfib.Print y;temp = x + yx = yy = tempLoopEnd Subany help is much appreciatedthanks

Fibonacci Series In Vb
does any one have any code for solving the fibonacci series using recursion in VB.

Need To Make A Code Using The Fibonacci Series
Fibonacci series: The Fibonacci series contains numbers where each number is the sum of the previous two numbers. It goes as follows: 0  1  1  2  3  5  8  13  21  34 If you look at each number, you will notice that it is the sum of the previous two numbers. Write an application that inputs a number between 0 and 100 and outputs the Fibonacci numbers up to the input limit.

please help! i need to make this program but i dont know how to write the code!

Fibonacci Sequence Help...
I need to make a program to display the fibonacci sequence. The numbers have to be listed in a list box, and every number has to be displayed. A user inputs a number and thats how far to go into the sequence EX: If someone inputs 4, the box should display 1,1,2,3
Right now I am trying to use an If Then statement that addsitems for every number, and it is very long, and not vereffiecent.

Is there a loop I could run?

Can I only use part of an array?

Help On Fibonacci Program
i put in the first two numbers of the sequenec as

Num(1)=1
Num(2)=1

and i used the formula :

Num(I+2)=Num(I)+Num(I+1)

so far i have this:

Option Explicit
Dim c As Integer
Dim x As Integer
Dim I As Integer
Dim l As Integer
Dim Num(100) As Integer

Private Sub cmdOutPut_Click()
Num(1) = 1
Num(2) = 1

c = 2

x = InputBox("How long do you want your Fibonacci sequence to be?", "Fibonacci Number Sequence")

Do Until c = x
c = c + 1
Num(c + 2) = Num(c) + Num(c + 1)
Loop

For l = 1 To x
Next l

End Sub

when I clickekd the cmdOutPut, all the answers in the listbox are 0,

Need Help With Fibonacci With A Loop
here is my calculatedata module, i am totaly lost on how to get the fibonacci program to work in VB.

Counter = 0
If StartNum <= 2 Then
Counter = 1
Else
Do While FinalNum >= StartNum
FibbNum = StartNum
FibbNum = StartNum + FibbNum
FinalNum = FinalNum * FibbNum - 2 + FinalNum * FibbNum - 1
Loop
End IF
MY assignment:
Your project should display a number from the Fibonacci series that corresponds with the number entered by the user. For example, if the user enters 8, the project should display 21. If the user enters 1, it should display 1.

You output should be in a sentence. An example of the sentence follows.

The 5th Fibonacci is 5.

aNY HELP WOULD BE GREATLY APPREACITED

Need Help With Fibonacci With A Loop
hey i need help making a fibanocci series code that has an input box asking for how many numbers you would like generate? and i need to make a loop so that i can compute it into a cell. Here's what i have so far [/CODE]

Sub Fibnumber()

Dim num As Integer
Dim Fibnumber As Integer
Dim Counter As Integer
Dim StartCell As String
Dim Endcell As String
Dim Row As Integer
Dim NumberOfFibNumbers As Integer
Dim rng As Range
Dim iNum1 As Integer, iNum2 As Integer, iNextNum As Integer
Dim i As Integer

NumberOfFibNumbers = InputBox("How many Fibonacci Numbers would you like generated from (1 to 20?)", "Welcome")
Row = 9
StartCell = "E9"
Endcell = "E29"
Set rng = Range(StartCell, Endcell)
rng(1).Value = num
rng(2).Value = Fibnumber
rng(3).Value = NumberOfFibNumbers

iNum1 = 0
iNum2 = 1
If num = 1 Then
Fibnumber = 1
Counter = 0
For i = 2 To num
iNextNum = iNum1 = iNum2 ' c = a + b
iNum1 = iNum2 ' a = b
iNum2 = iNextNum ' b = c
Next i
Fibnumber = iNextNum ' when found, return c
End If

Row = Row + 1
End Sub

Can somebody plz help and tell me what i need to add or what im doing wrong cause it wont compute the answer or put it in the right cell!

HELP! Need For Next Loop For Fibonacci!
I need a For Next loop that will print the first 10 Fibonacci numbers1,1,2,3,5,8,13,21,34,55)

kazooie21

Fibonacci Program Drives Me Nuts
I don't wanna look like [I'm lazy] and just asking to do a program for me, but I have been trying to figure it out for a total of 4 hours. The exact requirements are:

Code:
2) Write a program that will calculate the Fibonaci sequence up to a given element. Write a program that will allow the user to enter the 10, and the 34 will be calculated. Remember the Fibonaci sequence is generated by giving yourself the first two values, 0 and 1, and then adding the two previous values to get the next value.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,

For example:

Fibo(3) = Fibo(1) + Fibo(2) = 0 + 1 = 1
Fibo(4) = Fibo(2) + Fibo(1) = 1 + 1 = 2
Fibo(5) = Fibo(3) + Fibo(4) = 1 + 2 = 3
Etc.

Hint: You will need to preserve the TWO previous values in variables, not just the ONE previous value like we have done with all the rest of the loops.

Just throw suggestions out there. By the way, I use vb 6.0

Urgent! For Next Loop For Fibonacci Numbers!!
I need a For Next loop that will print the first 10 Fibonacci numbers 1,1,2,3,5,8,13,21,34,55)

How To Create A Function That Sums X Fibonacci Values?
I need to write a function that lets the user input three values:
1stnumber, 2ndnumber, totalnumbers
(where 1stnumber and 2ndnumber are any two consecutive numbers of the Fibonacci numbers, and totalnumbers the total amount of numbers),
then outputs the sum of these numbers.

For example: input 1, 2, 10
(this means the following sequence from the Fibonacci: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89)
and so the function would output the sum of that sequence, 232.

Easy, right?
Propably a loop is the way to do this? I'm really a beginner with VB, so all help is greatly appreciated!

I Need A For...Next Statement For A Square Root And Show Fibonacci Sequence
I need a For...Next statement that will show the square roots of 2 to 12 and only the even numbers.

I also need one that will show the first 10 numbers of the Fibonacci sequence.

kazooie21

IBM MQ Series
Does anyone have any sample codes or coding examples for communicating with the IBM MQ series software?

Yeah, yeah, I know . . . everyone does right? It's SUCH a common application . . . *sigh*

I've been all over IBM's site, but nothing is straightforward.

Any ideas, guys?

I'm working on VBA Excel to add new series to the same chart when I hit the f9 button. However, the graph keeps updating and I lost the previous graph that has been previously generated. How do I maintain all my previous graphs and continue to add new series generated by f9? I am aware the seriescollection may be involved. Thanks!

Series Of If...
I have a list box that is populated with some records. If no records being populated then user should get a message. like contact help desk. else code should continue but if one of the value in the list box is check.

table has this info: user id, gm, pm, tt, cc (gm,pm,tt,cc is true or false). i have to maintain a table with user ids and only allow them to install certain mdb.

Code:
Private Sub cmdInstallGM_Click()
'For this code to execute you must add a reference to the Windows Script Host Object Model (WSHOM.OCX).

Dim dbMyDB As Database
Dim rsMyRS As Recordset
Dim sSQL As String

Set dbMyDB = OpenDatabase("k:Plan_ManagerDataBank2k3_4.mdb")
sSQL = "SELECT DISTINCTROW ID, GM, PM, TT, CC FROM tblInstall WHERE ID= '" & Environ("USERNAME") & "';"

Set rsMyRS = dbMyDB.OpenRecordset(sSQL, dbOpenDynaset)

Do While Not rsMyRS.EOF

If IsNull(ListUserID) Then
Exit Sub
Else

If rsMyRS(1) = True Then

Dim nFolder As String

nFolder = "C:Documents and Settings" & Environ("USERNAME") & "My Documents"

If Len(Dir(nFolder & "iDatabases", vbDirectory)) = 0 Then
MkDir nFolder & "iDatabases"
End If

Me.MousePointer = 11

If Len(Dir(nFolder & "iDatabases" & "GM2k3.mdb")) = 0 Then
FileCopy "k:iSourceGM2k3.mdb", nFolder & "iDatabases" & "GM2k3.mdb"
FileCopy "k:iSourceFOLDHOLD.ICO", nFolder & "iDatabases" & "FOLDHOLD.ICO"
Call GMDesktopShortcut("G M")
MsgBox "READ: GM has been installed. Shortcut GM has been created and placed on your Desktop", vbCritical And vbExclamation
Else
Select Case MsgBox(Prompt:="A copy of GM already exists on you machine. Do you want to re-install GM?", Buttons:=vbExclamation Or vbYesNo)
Case vbYes
FileCopy "k:iSourceGM2k3.mdb", nFolder & "iDatabases" & "GM2k3.mdb"
FileCopy "k:iSourceFOLDHOLD.ICO", nFolder & "iSDatabases" & "FOLDHOLD.ICO"
Call GMDesktopShortcut("G M")
MsgBox "READ: GM has been installed. Shortcut GM has been created and placed on your Desktop", vbCritical And vbExclamation
Case vbNo
Me.MousePointer = 0
Exit Sub
End Select
End If

Me.MousePointer = 0

Else
End If

rsMyRS.MoveNext

End If

Loop

End Sub

2 Or More Series? HUH?
I hope some of you out there will be able to help me.

I am using a third party graphing utilitiy, called Flipper graph.

I am linking to my access 2000 DB.

I like this product and I would like to purchase it.

But I am having trouble with creating 2 or more series on the same graph.

I can produce one graph perfectly, by connecting to a database and sending the data to the FLPGRFADOLib.FlpADO object. The users does a search of the DB and results are obtained and graphed.

(Here is an explanation on how to use it - :
http://www.proworks.com/kb/ViewKnowl...?id=PW-1004713 )

What I want is multiple series on the chart, i.e the user can do another search for different results, and the results will be charted on the SAME graph as the previous.

All that happens is that the first chart is overwritten.

How do I do this?

Do I use new FLPGRFADOLib.FlpADO objects? And send the new data to them?

If I do, how do I then chart the new FLPGRFADOLib.FlpADO object, along side the previous one.

I hope you understand and can help me with my query, as I am anxious to solve it.

I have mailed the staff at www.proworks.com, but as yet no response.

Many thanks,

Steven

VB On IBM I-series
One of our clients has a requirment to develop a client/server application to be run on IBM i-series model 820 which runs V5R2.

Also the client has asked us to suggest alternative solutions like open systems or c or VB for i-series.
1) Can somebody give me some infomartion on open systems? 2) Is it a new OS or software that works with i-series?
3) Will the VB/Oracle combination work with i-series?
4) Is there a version of VB that runs on the i-series?
5) Which other combination is best suited for i-series?

Regards,
Anse

VB And MQ Series
Hi All,
I am just new to MQ Series using VB. I have a question in VB. How do I read a large file (1 MB+) into a single variable? And in relation to VB, I need to put that large file into a message queue. Any of you guys have an idea?

Rgds,
Dino

VB MQ Series
Hello Gurus,
Hi to all.

I'm a new VB programmer and need some help.

I have written a VB routine that formats an XML and puts on a MQ Queue (We use IBM Websphere MQ client). I have been able to MQPUT the message successfully from the machine I have logged on.

Now my requirement is to set it up for 7 users. So, we are thinking about setting up a group-id on the UNIX Server.
So, anyone who is in that group must be able to send the MQ Message. What properties do I have to set up on what MQ Object for me to do this?

MQ Client is on Windows 2000 and server is on UNIX.

I would appreciate your help in this.

MQ Series
Does anyone have any code or sites that would show how to send and recieve messages from MQ Series as opposed to MSMQ.

TANSTAAFL - There ain't no such thing as a free lunch

Mschart Need A Second Series!
I have an mschart object that works fine at plotting a graph from a 2D array. What i would really like is a solid line that stays in the same place to demonstrate a threshold. If anyone has any idea of how to draw a line as a second series it would be much appreciated.

Thank you

Alex

My First Rpg Ever... But Im Starting A Series
this is my first rpg i ever attempted to make in Visual Basic... I didn't know how to use the SetPixel or GetPixel stuff, but i'm sure going to look into it... I'm also exploring other Visual Basic features... this rpg is basic and as of right now kinda ****ty, but it will get better, it's in the beta stages right now, if you would like a copy please go to:

http://joe_fee.tripod.com/SetupMCB1.zip

it should work.. if you have any suggestions or to get a copy of the source code, please e-mail me, i'm interested, because I think i might scrap the whole project and start over...

Chart Series
I am loosing my mind here.. I know that there are other ways of doing this but it is too late to change my mode. I have a macro that is to assign new data values to existing charts. The way that I do it is that the charts and the series already exist. Now my macro reads input dates from a user through a user form. It then uses these dates to search for date ranges in different spreadsheets. These date ranges are the x-axis values. The data is store in an array like this:

varWorksheetInfoArray(0) = "Invest Abs rel"
varWorksheetInfoArray(1) = "Date"
varWorksheetInfoArray(2) = "USD (rel)"
varWorksheetInfoArray(3) = "IEUR (rel)"

I then use the info from this array and put in a range array (so that i can use the adresses).

Do While k < UBound(rng)
Set rng(k) = Worksheets(varWorksheetInfoArray(0)).Cells.Find(varWorksheetInfoArray( k), LookIn:=xlValues)
k = k + 1
Loop

and then I assign the x-values (this works I think all the time)
ActiveChart.Axes(xlCategory).Select
With ActiveChart
End With
it is now time for the y-values. they give a nice headache because they work in the sense that I think the code is right but you have to do something with the charts first. After having deleted and copied and pasted and what not it works. So i guess the code is right but it might be missing something or there is something specific that I need to do with the charts before being able to apply my code. Anyway here is the code (it finds the right addresses and everything:

k = 2 'start value
Do While k < (UBound(rng))
If Not IsEmpty(rng(k)) Then
Else: End If
k = k + 1
Loop

Now the thing is that sometime the series belong to a secondary axis. I have tried recording a macro and using the code in the loop like this:

ActiveChart.SeriesCollection(varWorksheetInfoArray(k)).AxisGroup = 1

I have tried putting the code in the beginning the end and on all possible places but it does not work. I doubt that this has anything to do with it but I cannot understand what you must do in order for it to work so.. Now is there anything that I should add/replace/delete from my code for it to work. I do not have the time to correct all the charts manually (there are about 100 charts and it takes me on average 15 minutes to get it to work since I do not know the problem). Please I beg if anyone has any concrete tips or know directly that there is something wrong etc. I would eternally grateful for your help! This is really killing me and I do not know where to look in order to learn something about it. As I said I know that there are probably other ways of updating these charts but I cannot (for various reasons) write code for all charts or something like that. I mean the code finds the correct range for every series for every chart but it is (just) the problem of applying these ranges to the charts. Again all help is appreciated!

Sincerely,

Viktor Ygdorff

Using VB6 And Websphere MQ Series
Hello,

I'm planning to write a tool to retrieve MQ messages from an IBM MQ Series server (Webspehere). Following functionalities i'm looking,

1. PUT Messages
2. GET Messages
3. Message INFO
4. DELETE Message

Chart With Two Series
I am trying to create a chart with two series
(a) chChartTypeStockHLC
(b) chChartTypeLine
using Visual Basic 6 with Microsoft Office Web Components XP.

I can do either (a) or (b) but not both. When I try to combine both, I end up with two lines.

My code is

Dim hArray() As Variant
Dim lArray() As Variant
Dim cArray() As Variant
Dim catArray() As Variant
Dim mArray() As Variant
catArray = Array(1, 2, 3, 4)
hArray = Array(4, 5, 6, 7)
lArray = Array(2, 3, 4, 5)
cArray = Array(3, 4, 5, 6)
mArray = Array(1, 2, 3, 4)

Dim chConstants
ChartSpace1.Clear

Set chConstants = ChartSpace1.Constants

ChartSpace1.Charts(0).SeriesCollection(0).Type = chConstants.chChartTypeStockHLC
ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimCategories, chConstants.chDataLiteral, catArray
ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimHighValues, chConstants.chDataLiteral, hArray
ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimLowValues, chConstants.chDataLiteral, lArray
ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimCloseValues, chConstants.chDataLiteral, cArray

ChartSpace1.Charts(0).SeriesCollection(1).SetData chConstants.chDimCategories, chConstants.chDataLiteral, catArray
ChartSpace1.Charts(0).SeriesCollection(1).Type = chConstants.chChartTypeLine
ChartSpace1.Charts(0).SeriesCollection(1).SetData chConstants.chDimValues, chConstants.chDataLiteral, mArray
ChartSpace1.Charts(0).SeriesCollection(1).Ungroup
End Sub

MS MQ Series (Urgent)
Hi Friends,

I know that this is the wrong forum to POST for my question. Can anybody knows the use of MQ Series with VB & ASP. It will be better if some one provide me a link that contains document or descriptive usage of MQ Series.

Help is appriciated.

Series Of DAO Queries:
I have 5 SQL queries in Access; most are daisy chained:

--Queries 2 and 3 are dependent on Query 1
--Query 4 is dependent on Queries 2 and 3
--Query 5 is dependent on Query 4.

Queries 1, 2 and 3 are SELECT queries.
Queries 4 and 5 are INSERT INTO queries.

So, if I'm just working from inside the Access development environment, to execute the entire thing all at once, all I have to do is open up Access and click on Query 5. In fact I have, and it works.

My problem: I need to duplicate this functionality in Visual Basic. I've tried all day to do this in a VB module, and failed. I don't know how to do it. Everything I've tried yields nothing in the end results table.

Can someone show me a DAO example of daisy-chained queries, (at least one of which is a SELECT, and one of which is a db.Execute INSERT)? E.g.,

sSQL_n = "SELECT...INTO..."

followed by

ws.BeginTrans
db.Execute "INSERT...INTO..."
ws.CommitTrans

I really need help with this. Thanks.

HELP - Reports(series)
I need help. This is the situation....

There's already one report that shows an employees timecard for the past month. What I was tasked to do was to make a report using the same format but this time it's for all of the employees. I'm having a really hard time.

I'm using VB6 and MS Access.

I hate my job.

Series Line
how to make my series lines to be drawed longer so the lines crossed each other.? i'm using mschart component. chart 2dxy
thank you

Series In Rows
Hi,
when i create a chart in excel i have an ontion to selct Series in column or rows;
how can i choose Series in rows in VBA?

Thank you

Hide A Series In A Chart
Worksheets("Sheet3").ChartObjects("Chart 1").ProtectChartObject = True
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).ChartType = xlLine
...

ActiveChart.Plot.SeriesCollection(2).Position.Hidden = True

I tried the above code for hiding Series 2 taking the hint from the following solution suggested for a similar query. perhaps i understood it wrong!

With MSChart1.Plot
For i=1 To MSChart1.ColumnCount
.SeriesCollection(i).Position.Hidden=True
Next
End With

But i get an error method or data member not found. even when i remove the plot method it doesn't work..pls help..

How To Hide Series In A MSChart?
Hi!

I have a MSChart that displays two series. The data is taken from a access database. Sometimes I only want to display one of the series in my chart. Is it possible to hide the other one for example with a button or a checkbox?

Outlook Series-date
I need to read further information out of an series-date from the Outlook calendar. If you read it like an normal date, the duration is only one day. Is there a chance to get the real information. If the series-date is about three days I need to get this duration instead of only one day.
Thanks,
Andreas

( I am using Outlook 2002)

Running A Series Of Modules
Ok, I'm a complete beginner to VB. I really do not have a clue about it but what I did manage was to produce a series of modules (I think - they're .bas files?) which perform the functions I want, one after another.

The problem is that I am having to run each module, one at a time by importing the 'filename.bas' files and playing each one individually.

The programs are called insight1.bas, insight2.bas, insight3.bas and insight4.bas. I had tried to put these together in a function using...

Sub run_all_insight

Call insight1
Call insight2
Call insight3
Call insight4

End sub

...but this did not work. How can I put these 4 modules into one bit of code which will run each of them one after another. The code in all of them is too large to fit into one module.

I would also like to have a small form on the screen so that when I open the particular excel sheet, the form is visible and the button will run my code without having to import any .bas files.

Thanks for any help you can provide. I told you I was a complete beginner!

Chris

Values Of Selected Series
Hello,

I have one xlXYScatter Chart with several SeriesCollections. Now I want, that when the user select one Series and click on a button "select" to get the XValues and Values of the selected SeriesCollection. Is this possible?

stepsc

Way To Find Series Intersection?
I am looking for some insight on how to accomplish the following... below is some pseudocode... for VB6/Excel.

Code:
If series 1 intersects series 2 then
'at any point
MyFlagTest = Fails
elseif
'no intersection at all
MyFlagTest = Passed
end if

...basically, is there a function or easy way to see if two series on a graph intersect at any point?

Series Collection Problem...
Hi there I have a big problem Under Excel...

I make a macro that make a simple graph from two columns, the problem occurs when I try to put data into x-axis using macro recorder the result is this:

Code:
Sub Macro14()

ActiveChart.Axes(xlCategory).Select
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "=Datos!R4C1:R604C1"
ActiveChart.SeriesCollection(2).XValues = "=Datos!R4C1:R604C1"
End Sub

But when I run this macro, this msg appears: " Unable to set the XValues property of the Series class", and the debug show me that the problem is here:

Code:
ActiveChart.SeriesCollection(1).XValues = "=Datos!R4C1:R604C1"

,but I see and everything seems to be right so Im confused with that, plz help!!

Adding New Series To The Chart
I try to make a code adding new series. But there is problem in addressing.
What would you think for the code below:

Sheets("Grafik1").Select
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Values = "=Sayfa1!" & Range(Cells(300, 7), Cells(600, 7)).Address(True, True)

Series Of Questions - VB Noob Here : (
Im actually a newbie in VB so i really appreciate if you PROs help me coz im having trouble in:

1. I have an image w/c is draggable. What code will do if when after i drag the image into an empty image* it will open a form.

I mean, i drag an image into an empty image by using OLEDragmode=automatic, same as OLEDropmode. Then after i drop the image, i can call any actions like:
form2.show

2.) Theres label1, a cmdbutton, a textbox.

label1.text = "laybel"

i run the form, then i enter "New" in the textbox. then hit the cmdbutton to change the label1.text into "New". Then close the form.

Obviously, the label will still be "laybel" when i run the form again.

What code will do to make the label1.text to be "New" ?

i know this is simple and very basic, but i really need your help.

btw: The program that im doing isnt really that Simple, i just give examples to know the logic. :/

MSChart And The Series Markers
Hi all,

How can I change the series markers in mschart control for xy plots.
thank you

Unable To Set XValues Of A Series
Hi,
I am generating charts in Excel and if I try to put more than 10 points on the X-Axis I received the error "Unable to set the XValues property of the Series Class". I get no such error for the Values property. I thought at first it was the data, however after extensive testing I am sure that data is not the problem. A snippet of my code is:
Code:
If myCnt25 > 0 Then
ReDim Preserve C25Date(myCnt25 - 1)
ReDim Preserve C25Value(myCnt25 - 1)
ws.Name = ChtSheetName
ActiveWindow.DisplayGridlines = False
(Left:=100, Width:=375, Top:=75, Height:=225)
.Chart.ChartType = xlLineMarkers
End With
ActiveSheet.ChartObjects("Chart 1").Activate
Set ns1 = ActiveChart.SeriesCollection.NewSeries
ns1.XValues = C25Date
ns1.values = C25Value
'It bombs at the line "ns1.XValues = C25Date"
'I've tried using C25Date() with the same results.
'I've tried:
With ActiveSheet.ChartObjects("Chart 1").Chart
.SeriesCollection(1).Values = C25Value()
.SeriesCollection(1).XValues = C25Date()
End With
The result was the .Values worked OK, and the .XValues caused the error.
I'm not very skilled at this and am probably making a goofy mistake. Any assistance will be much appreciated.
Thanks, Will.

Chart Series Names
The macro below works fine to automatically place the designated number of plots on the same chart, but only if the line:

Code:
ActiveChart.SeriesCollection(M).Name = "=""Name " & M & ""

is disabled. When enabled a message appears that states "Unable to set Name property in series class".

Any suggestions for syntax?

Code:
Dim Q As Integer
Dim M As Integer
Dim L As Integer
Dim J As Integer

ActiveChart.ChartType = xlXYScatterSmooth

ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1")

Q = 2
L = 6
J = 8

For M = 1 To Q

ActiveChart.SeriesCollection.NewSeries

ActiveChart.SeriesCollection(M).XValues = "=Sheet1!R[" & L - 1 & "]C4:R[" & J - 1 & "]C4"
ActiveChart.SeriesCollection(M).Values = "=Sheet1!R[" & L - 1 & "]C5:R[" & J - 1 & "]C5"
ActiveChart.SeriesCollection(M).Name = "=""Name " & M & ""

L = L + 4
J = J + 4

Next M

Plotting Using Add Series Method In VBA
Hi,

I am having a little trouble with using VBA to plot an x-y scatter chart using the add series method.

I have attached a sample spreadsheet that hopefully shows what I am trying to do. The plot shows what I want to achieve, ie, a set of vertical lines which are independent of each other. I would like to be able to do this for any number of rows of data. The data will always consist of two columns.

Anybody got any ideas on what I should be doing to achieve the desired result?

Thanks.

MSChart Series Problem
Hi

I am using MSchart in VB 6. and i have 2 series in it. i want to show one these series in contious line format and the other one in DashDitDit format , so i did so
MSChart1.Plot.SeriesCollection(1).Pen.VtColor.Set 0, 0, 0
'MSChart1.Plot.SeriesCollection(2).Pen.Style = VtPenStyleDashDitDit
MSChart1.Plot.SeriesCollection(2).Pen.Style = VtPenStyleDotted
MSChart1.Plot.SeriesCollection(2).Pen.VtColor.Set 0, 0, 0

and it is done, and no problem up to here but when i print the chart , it is appear in contionus line format in both series.

i have tested it in 3 different printer but they act the same. how can i present one those series in diffrent line format?

MSChart Series Colors
Is there anyway to set the default color for all series in an MSChart? Is there anyway to run a check on an array to see if a value is positive or negative and then color the MChart bar a certain color? Any suggestions would be much appreciated!

A Series Of Prints From The Web Browser
Edit: Sorry, the problem was in one of my variables (iLoop)

I'm trying to print a series of invoices using the webbrowser control.

Here's the code just if you want to give it a glance to see what I'm trying to do here:

Code:
Private Sub cmdPrintSelected_Click()

Dim iLoop As Integer
Dim sKey As String
Dim sLine As String
Dim sFields() As String
Dim sItemSplit() As String
Dim iItemCount As Integer

For iLoop = 1 To tvwInvoiceRecords(1).Nodes.Count

If Right\$(tvwInvoiceRecords(1).Nodes(iLoop).Key, 1) = "k" Then

Debug.Print tvwInvoiceRecords(1).Nodes(iLoop).Text

sLine = lvwCustomers.ListItems(tvwInvoiceRecords(1).Nodes(iLoop).Key)
sFields = Split(sLine, sDLim)

sBillTo(0) = sFields(1) & " " & sFields(2)
sBillTo(1) = sFields(3)
sBillTo(2) = sFields(4)
sBillTo(3) = sFields(5)

iItemCount = -1
snPriceTotal = 0

Do While Right\$(tvwInvoiceRecords(1).Nodes(iLoop + 1).Key, 2) = "bi"

iLoop = iLoop + 1
iItemCount = iItemCount + 1
sItemSplit = Split(tvwInvoiceRecords(1).Nodes(iLoop).Text, " - ")

sItem(iItemCount) = sItemSplit(1)
sPrice(iItemCount) = sItemSplit(0)

snPriceTotal = snPriceTotal + Val(Replace\$(sPrice(iItemCount), sCurrencySymbol, vbNullString))

If iLoop + 1 > tvwInvoiceRecords(1).Nodes.Count Then Exit Sub
If iItemCount = 5 Then Exit Do

Loop

Call PrintInvoice

End If

Next

End Sub

Private Sub PrintInvoice()

Dim strPage As String
Dim byLoop As Byte

Open "f:miminvoice.html" For Input As #1

strPage = Input\$(LOF(1), 1)

Close #1

strPage = Replace\$(strPage, "[CompanyName]", GetSetting("MIM", "CompanyDetails", "CompanyName", "[My Company]"))
strPage = Replace\$(strPage, "[CompanyPhone]", GetSetting("MIM", "CompanyDetails", "CompanyPhone", "[Company Phone #]"))
strPage = Replace\$(strPage, "[GeneralServiceDescription]", GetSetting("MIM", "CompanyDetails", "GeneralServiceDescription", "[GeneralServiceDescription]"))
strPage = Replace\$(strPage, "[CompanySlogan]", GetSetting("MIM", "CompanyDetails", "CompanySlogan", "[Our Slogan]"))

strPage = Replace\$(strPage, "[MakeChecksPayableTo]", GetSetting("MIM", "CompanyDetails", "MakeChecksPayableTo", "[MakeChecksPayableTo]"))

strPage = Replace\$(strPage, "[TodaysDate]", Date)

For byLoop = 0 To 3
strPage = Replace\$(strPage, "[BillTo" & Trim\$(Str\$(byLoop)) & "]", sBillTo(byLoop))
Next

For byLoop = 0 To 5
strPage = Replace\$(strPage, "[Item" & Trim\$(Str\$(byLoop)) & "]", sItem(byLoop))
Next

For byLoop = 0 To 5
strPage = Replace\$(strPage, "[Price" & Trim\$(Str\$(byLoop)) & "]", sPrice(byLoop))
Next

strPage = Replace\$(strPage, "[PriceTotal]", FormatCurrency(snPriceTotal))

Timer1.Enabled = False

WebBrowser1.Document.Open
WebBrowser1.Document.Write strPage
WebBrowser1.Document.Close

WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0

End Sub
What happens is no matter how many accounts are selected, it loops through but always quits after printing one invoice.

I'm guessing the line that prints the webbrowser is coming along too fast or something.

Anyone know how I can loop this printing of webbrowser pages?

Displaying A Series Of Images
Hello all,
I am trying to display a series of images in 3 image boxes There may be any number of images to display (from 0 to many). The path is held in a data base the images elsewhere. Then I want to is on clicking a command button to move through the images i.e. the first image is not shown and image 2, 3 and 4 from the recordset are shown in the image boxes. Up to here is fine. The problem I'm having is that when the last available image is displayed in the last box I want the movement to stop (clicking the button has not effect), but I can't stop it at the correct point, what I'm getting is process moves on once too often and the last image is shown in the last 2 boxes. As you see I'm trying to use recImage.EOF to exit the sub, but I've looked and looked but just can't get it right.

I'm probably going about the whole process in a poor way, so all suggestions appreciated and if somethings not clear please ask.

Thanks

Private Sub CmdMoveNextImage_Click()

varrecImagePosition = varrecImagePosition + 1

For varImageStep = 1 To varrecImagePosition
If Not (recImage.EOF Or recImage.BOF) Then
recImage.MoveNext
If recImage.EOF Then
recImage.MoveLast
Exit Sub
End If
Else
Exit Sub
End If

Next varImageStep

End Sub
_____________________________

For I = 0 To 2

If recImage.EOF Or recImage.BOF Then
Exit Sub
End If

Text1(I).Text = recImage.Fields("Imagenotes")

mx = 2655 / ScaleX(imgView(I).Picture.Width, vbHimetric, vbTwips)
my = 1695 / ScaleY(imgView(I).Picture.Height, vbHimetric, vbTwips)

If mx < my Then
imgView(I).Height = mx * ScaleY(imgView(I).Picture.Height, vbHimetric, vbTwips)
imgView(I).Width = 2655
Else
imgView(I).Width = my * ScaleX(imgView(I).Picture.Width, vbHimetric, vbTwips)
imgView(I).Height = 1695
End If

recImage.MoveNext
Next I

recImage.MoveFirst

Hi everyone,
how do I add separate series from an array to a 2DXY graph? I'm trying this:

Code:
Private Sub cmdPlotme(myIn As Integer)
ReDim myData(1 To 4, 1 To UBound(curvearray(myIn), 2)) As Variant
myData(1, 1) = "d 1"
myData(2, 1) = "%T 1"
myData(3, 1) = "d 2"
myData(4, 1) = "%T 2"
For I2 = 2 To upper
myData(1, I2) = curvearray(1)(1, I2)
myData(2, I2) = curvearray(1)(2, I2)
myData(3, I2) = curvearray(2)(1, I2)
myData(4, I2) = curvearray(2)(2, I2)
Next I2
With MSChart1
.ChartType = VtChChartType2dXY
.Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypeLinear
.Plot.Axis(VtChAxisIdX).AxisScale.Type = VtChScaleTypeLinear
.Plot.UniformAxis = False 'Tip from KB article Q194221:
.ChartData = myData 'this results in error '1101' -Bad function argument
End With
End Sub

I keep getting "Bad function argument" what am I doing wrong?

Outputing Series Of #'s To Form
I need to list a series of numbers that are calculated during runtime. There will be ~10-20 of them. They are stored in an array.
I tried outputing them on one line of a label but could not figure out how to "index" the label so I could parse through the array.
Is there any way to do this with a label, text box?

Thanks

Richard

Multiply Of A Series Of Numbers
I have the following function with a for...next loop. I need to multiply the seriers of numbers as indicted.

Function product()
Dim n As Integer, y As Integer = 1, x As Integer
n = InputBox("Please enter a number between 1 and 30")
For x = 1 To n
txtOutput.Text = y
y += y * n
Next
End Function

I get the following error when running:
"Arithmetic operation resulted in an overflow."

How do I get it to calculate without overflow?