Databases Reference
In-Depth Information
'Determine Starting Column
For ii = 1 To Len(topleft$)
If Mid(topleft$, ii, 1) = "C" Then
startcol = Val(Mid(topleft$, ii + 1, Len(topleft$)))
Exit For
End If
Next ii
'Determine Ending Column
For ii = 1 To Len(bottright$)
If Mid(bottright$, ii, 1) = "C" Then
endcol = Val(Mid(bottright$, ii + 1, Len(bottright$)))
Exit For
End If
Next ii
If startcol = endcol Then
ColumninRange = startcol
Else
ColumninRange = 0
End If
End Function
With the minimum and maximum values now known, it is possible to create a data set with
equidistant members with the following snippet of code.
For ii = 1 To TotalPoints - 1
'Create a spaced set of points (X's)
XVal = Xmin + (ii - 1) * ((Xmax - Xmin) / (TotalPoints - 1))
'Solve for y of current Xval
Yval = Slope * XVal + Intercept
'Write XY pair to Worksheet
Workbooks(ActiveWorkbook.Name).Worksheets(DataSheet$).Cells
(i i, 1) = XVal
Workbooks(ActiveWorkbook.Name).Worksheets(DataSheet$).Cells
(ii, 2) = Yval
Next ii
'Last Point
XVal = Xmax
'Solve for y of current Xval
Yval = Slope * XVal + Intercept
Workbooks(ActiveWorkbook.Name).Worksheets(DataSheet$).Cells
(ii, 1) = XVal
Workbooks(ActiveWorkbook.Name).Worksheets(DataSheet$).Cells
(ii, 2) = Yval
The desired precision of the generated data set can then be set with the SetColPrecision
subroutine as follows.
Search WWH ::




Custom Search