VBA: Update worksheet when txtBox data changes.

M

Mcasteel

Im trying to change a worksheets cell value when an end-user changes th
value of a txtBox on a customized form.

Essentially Im pulling information from an excel file and some of tha
information may need to be changed by the end-user.

how to I submit any changes back to the spreadsheet once a end-use
changes a field?

Here is the code for the lookup feature to give you an idea of what I
working with.
===================================================
Dim rng As Range

With Worksheets(1)
Set rng = .Columns(6).Find(txtCustSSN.Text)

If Not rng Is Nothing Then
'Populate frmCustLookup with Customer Information
txtLname.text = .Cells(rng.Row, 3).Value
txtFname.text = .Cells(rng.Row, 4).Value
txtMname.text = .Cells(rng.Row, 5).Value

Else: MsgBox "Customer Data Not Found"

End If

End With

End Sub
=====================================================

So for example we look up Ms. Smiths record (by SSN), and need t
change her last name since she has recently been married.

when the user types: Andersen over top of Smith how do I send tha
update back to the worksheet?

I'VE CREATED A COMMAND BUTTON \"CMDUPDATERECORD\" TO SUBMIT TH
CHANGES, BUT IM NOT SURE WHAT CODE TO USE


Thank you for your advice, I know the solution should be easy, but m
coding is a little rusty. :confused
 
B

Bob Phillips

Mike,

Why not set the textbox ControlSource property to the worksheet cell, it
will automatically update then.

--

HTH

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

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