View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default need help determining a row number

Where Bob has
myRow = Application.VLOOKUP(uf_val,Worksheets("Sheet1").Ra nge("A1:A100",0)

should be

myRow = Application.Match(uf_val,Worksheets("Sheet1").Rang e("A1:A100"),0)


--
Regards,
Tom Ogilvy

"Bob Phillips" wrote in message
...
Gary, why don't you just use MATCH against the first column of the lookup
data to get its index

myRow = Application.VLOOKUP(uf_val,Worksheets("Sheet1").Ra nge("A1:A100",0)

If the table does not start in row 1 do not forget to add the number of

rows
preceding it as MATCH returns the index into the data not the row number.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
kind of complicated for me to understand. i ended up just adding a

rownumber
field and put it into a hidden textbox on the form. i have no idea

what's
going on here now, because i did just about the same thing on my first

form
programming, but every time i try to change and update a record, only

the
first field changes.

but i think i have it now


Gary


"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