Userform to grab,correct and restore data

J

jimapos

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..
 
D

Dave Peterson

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top