Thread: Edit Forms
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Edit Forms

turn on the macro recorder, then do
Edit=Find
and use Whatever as the search term

then change the recorded code from

Selection.Find(what:="Whatever", . . .).Activate

to
set rng = Columns(1).find(What:="Whatever", . . .)
if not rng is nothing then
' cell was found
with userform1
.textbox1.Text = rng
.textbox2.Text = rng.offset(0,1)
End With
else
' not found
End if


or if you want to loop through your data, you can use your approach.
--
Regards,
Tom Ogilvy


"Steve" <No Spam wrote in message ...
Tom

I think I have it.
If userID = "whatever" Then
TextboxLinenumber = i
...
end if

Correct?

Steve

"Steve" <No Spam wrote in message ...
Tom
I get the general idea but, there may be a thousand or so records. Would
there be a way to load the data and filter it down (example by date or
user loginID)?

--
Steve

"Tom Ogilvy" wrote in message
...
in you code to load the record, you would just use code like

Textbox1.Text = Cells(i,1)
TextBox2.Text = Cells(i,2)

then to write it back, you similar code to that which you say you know.

Cells(i,1) = Textbox1.Text
Cells(i,2) = Textbox2.Text

--
Regards,
Tom Ogilvy


"Steve" <No Spam wrote in message ...
I know how to create a form to add records in Excel. My need is to
create
a
form that allows a user to edit an existing record, without allowing

the
user to delete a record. Can someone point me in a helpful direction?

--
Steve