LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Ali Baba
 
Posts: n/a
Default Speed up the process

hi

I have this code which can plot any formula with two variables, ie x + y = 0

The code takes the x values from A1:A2 and loops till y is found. This
takes a while, so is there a way to speed this code.

Sub PlotXY()
Dim x As Double
Dim i As Integer
Dim y As Variant
Dim f As Double
Dim fs As String
Dim fsx As String
Dim fsy As Double

fs = InputBox("enter fs")
Range("c1") = fs

With Range("A1")
For i = 1 To 20
x = Cells(i, 1)
y = -5.0001
fsx = Replace(fs, "x", x)

Do
y = y + 0.0001
If IsError(Evaluate(Replace(fsx, "y", y))) Or Abs(y) 5 Then
y = "#N/A"
Exit Do
Else
fsy = Evaluate(Replace(fsx, "y", y))
End If
Loop Until Abs(fsy) < 0.001

.Cells(i, 2).Value = y
Next i

End With
End Sub
 
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
Calculation Speed TJ Excel Discussion (Misc queries) 2 September 22nd 05 04:38 PM
Speed up and slow down, the auto-scroll. Jack Tripper Excel Discussion (Misc queries) 0 September 11th 05 03:54 PM
How to Reduce Spreadsheet Size and Speed ExcelMonkey Excel Worksheet Functions 4 August 9th 05 06:38 PM
search multiple worksheets name with common text and process using mango Excel Worksheet Functions 1 December 22nd 04 02:11 PM
Simplify Process with Excel 2003 Zraxius New Users to Excel 1 December 5th 04 01:55 PM


All times are GMT +1. The time now is 05:06 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"