View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Userform to grab,correct and restore data

Can you pick out a key column that contains the unique key for that row?

then you could look at that column, look for a match with one of your textbox
values, and determine the row.

dim res as variant
dim myRng as range

with worksheets("sheetnamehere")
set myrng = .range("a1", .cells(.rows.count,"A").end(xlup))
res = application.match(me.textbox1.value, myrng, 0)
if iserror(res) then
'no match, new record to add????
else
msgbox "match was found in row: " & res
with myrng(res)
.offset(0,1).value = me.textbox2.value
.offset(0,2).value = me......
end with
end if

(Untested, uncompiled)


jimapos wrote:

Hi all
I have a userform that stores data (1 row record with 20 columns) to a
worksheet.Is there a way to grab the data back in (other or the
same)userform, ambent(correct) data and store them back in the same row
in the worksheet?
An example or code will be appreciated.Thanks anyway for your
attension... or help.

P.S. The userform contains 20 textboxes and 1-2 listboxes..


--

Dave Peterson