Re: Formating and Precision...I think
- From: "NickHK" <TungCheWah@xxxxxxxxxxx>
- Date: Thu, 24 Aug 2006 10:27:38 +0800
Steven,
Yes, you probably have a number of versions of ADO.
Depends who else will be using your workbook. If it's only for you, use the
latest.
If you will distributing to a lot of unknown users, may be the oldest.
To me, there not a great deal of difference between them in the general
sense.
Here a brief list of ADO version/OS
http://www.teratrax.com/articles/mdac_ado.html
ActiveX Data Objects Recordsets 2.7 Library:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q183606
but I guess you do not need this.
NickHK
"Steven Cheng" <StevenCheng@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FAFB0424-1909-431E-A7A4-38FF9E9FBF3C@xxxxxxxxxxxxxxxx
Sorry, just one more thing...what is the differences between the differentObjects
ActiveX Data Object libraries....just different versions/updates along the
way? also, I see one called ActiveX Data Objects Recordsets 2.7 Library?
what is this for?
"NickHK" wrote:
Steven,
You don't need Access, just a reference to "Microsoft ActiveX Data
workx.x Library".
Your Excel data needs to be in a regular table structure for this to
http://www.microsoft.com/technet/scriptcenter/resources/officetips/jun05/tips0607.mspxcorrectly.
Then just query the file with SQL.
Here's one:
referencing to
NickHK
"Steven Cheng" <StevenCheng@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D009B442-F393-479E-9482-B234D1676A99@xxxxxxxxxxxxxxxx
NickHK;
I didn't think of this. Is ADO accessible in Excel without
inan Access library file?that
"NickHK" wrote:
Steven,
As long as your data in the range "RCSLData" is sorted on your first
criteria, say Period, the you can cut down on the amount of the list
you search. You can down further .finding the second criteria only
SQLthe
Accountrange that matches the first etc. Something like
Dim PeriodStart As Range
Dim i As Long
Set PeriodStart = Range("RCSLData").Columns(1).Find(what:=Period)
With PeriodStart
Do Until .Offset(i, 0).Value <> Period
If .Offset(i, 1).Value = DeptID And .Offset(i, 2).Value =
And .Offset(i, 2).Value = FiscalYear Then
GetValue=<YourValue>
Exit Function
End If
i = i + 1
Loop
End With
GetValue = CVErr(xlErrNA)
To me though the easiest way would be to use ADO and just issue an
aDeptID="statement, leaving the hard work up to the db components.
"SELECT FinalValue FROM RCSLData WHERE Account= """ & AccStr & """,
function's& DeptID & ", DayofPeriod=" DayofPeriod.....etc
You can further process any records returned before returning the
result.
The workbook holding the data would need to closed though and be in
messagetable
format.
NickHK
"Steven Cheng" <StevenCheng@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
problemnews:D43E9D0A-3853-4C05-A86C-660FCB755E39@xxxxxxxxxxxxxxxx
thanks NickHK. I will check out the .text and .value for the
rangecells.
as for the easier search, how do I find/vlookup to narrow the
youthat I
copy),am looking through?
"NickHK" wrote:
Steven,
Not sure what you mean about the formatting problem.
What is .Value and .Text of the problem cell(s) ?
Do you have Tools>Options>View>Zero values checked ?
As for making you search easier:
If you can sort the range "RCSLData" on the work*** (or sort a
then
..Find/VlookUp the range that match the first widest criteria,
ofwill
criteriahave
narrowed your search considerable. Work your way through your
searching a narrowing range, until you find a match, or run out
yourows.
Array are very fast and you can achieve the same as above, but
Singlehave
messagedo
all the work yourself.
NickHK
"Steven Cheng" <StevenCheng@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
DayofPeriodnews:42BC9531-982F-45AE-A183-CEA50550A3F7@xxxxxxxxxxxxxxxx
I have a UDF that goes like this:
Private Function GetValue(Account As String, DeptID As String,
As Integer, Period As Integer, FiscalYear As Integer) As
rcslarray(lastrow,Dim rcslarray
Dim tempholdingcell As Double
Dim lastrow As Integer
rcslarray = [RCSLData]
GetValue = 0
For lastrow = 2 To UBound(rcslarray, 1)
If rcslarray(lastrow, 2) = Period And
=3) =
DeptID
And rcslarray(lastrow, 4) = Account And rcslarray(lastrow, 1)
DayofPeriod +FiscalYear
Then
If Mid(Account, 1, 1) = 3 Then
tempholdingcell = rcslarray(lastrow,
DayofPeriod +4)
* -1
Else
tempholdingcell = rcslarray(lastrow,
the4)
End If
End If
Next
GetValue = tempholdingcell
End Function
basically, its take a range passing it into an array, finding
getreturningvalues I
want from the parameters passed over by the funciton, and
formatingthe
value
I want.
problem is when it is returning a zero value, although the
shouldis
correct in the cells, it shows up as $0 rather than $- as it
there isbe. I
tested the value to see if it returned a 0 value to find that
some
"rounding" or lack of precision. is there anyway that i can
andthis
done
within the function?
PS. I tried the rounding tempholdingcell but that didn't work
single.I
have
tried to alter the data type of GETValue from double to
points
PSS. since the range is rather large and there are 5 data
betterto
search
through, is there a way of speeding this up as well? or a
work***
function?
.
- References:
- Re: Formating and Precision...I think
- From: NickHK
- Re: Formating and Precision...I think
- From: Steven Cheng
- Re: Formating and Precision...I think
- From: NickHK
- Re: Formating and Precision...I think
- From: Steven Cheng
- Re: Formating and Precision...I think
- From: NickHK
- Re: Formating and Precision...I think
- From: Steven Cheng
- Re: Formating and Precision...I think
- Prev by Date: Recalling a previously active work***
- Next by Date: Re: Page Break After 7 Inches
- Previous by thread: Re: Formating and Precision...I think
- Next by thread: VBA code to filter data
- Index(es):