Posted to microsoft.public.excel.programming
|
|
need help determining a row number
David, I get a 'Type Mismatch' on the line:
dArray(i)= v(i,1)-u(i,1)
I don't see what it is.
Mike F
"davidm" wrote in
message ...
Gary,
Copy the records to variant array before the user-change and then
re-copy same range into a second variant array. Next take the
differences between the two: changes will be reflected by zero
differences. It is inconsequential whether data is numeric,
alphanumeric or whatever.
Illustration:
Dim v
Dim u
Before user effects changes:
'create 1st variant array
v=Range("a1:a100").value
After changes:
'create 2nd variant array
u=Range("a1:a100").value
'copy diffs to normal array
Dim dArray()
For i = 1 to Application.CountA([a:a])
Redim preserve dArray(1 to i)
dArray(i)= v(i,1)-u(i,1)
Next
'determine row nos where changes were made by setting dArray(x)= 0
For x = 1 to Application.CountA([a:a])
If dArray(x)= 0, then
k = k & "Row " & x & ":"
end if
Next
Msgbox k 'lists all rows wuth changes
End sub
HTH
David
--
davidm
------------------------------------------------------------------------
davidm's Profile:
http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=484491
|