View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copy and move info between files

You description is not very clear, but here is a guess. It assumes a
userform with 3 textboxes. User enters Personid in Textbox1, value1 in
Textbox2, value2 in textbox3.
Sheet1 has a list of PersonId's in column A starting in row1 and you want to
place the values in Textbox2 and Textbox3 in columns B and C respectively in
the same row as the matching personid

Private Sub Commandbutton1_click()
Dim rng as Range, rng1 as Range
Dim res as Variant
Dim Personid as String
With Worksheets("Sheet1")
set rng = .Range(.Cells(1,1), .Cells(1,1).End(xldown))
End With
Personid = Textbox1.Text
res = Application.match(PersonId, rng, 0)
if not iserror(res) then
set rng1 = rng(res)
rng.offset(0,1).Value = Textbox2.Text
rng.offset(0,2).Value = Textbox3.Text
end if
End if

--
Regards,
Tom Ogilvy

"Pat Fern" wrote in message
...
I need to gather information from users and have the
information stored in a excel file on a sheet with 3
columns. That information is structured like this

PERSONID - VALUE1 - VALUE2

What I would like to do with this information is have a
button on another sheet which would look into the file and
look for the corresponding ID take values 1 and 2 then
paste them into the corresponding columns for the Person.
Instead of the row been deleted this would need to be then
moved into another sheet in case this needs to be checked
afterwards.

Any Ideas?