PDA

View Full Version : Solved: Amend cell in row based on value in first cell



lifeson
07-20-2007, 07:39 AM
I have a form which displays the contents of a row of cells wher the first cell is a unique Id for that row (a Pay roll number)

I want to be able to amend the details shown on the user form and then those amendments alter the cells in the same row as the unique ID accordingly

Bob Phillips
07-20-2007, 07:59 AM
When you get the details, save the row number, then use it to write-back



Range("A" & SavedRow).Value = TextBox1.Text


etc.

lifeson
07-20-2007, 08:27 AM
When you get the details, save the row number, then use it to write-back



Range("A" & SavedRow).Value = TextBox1.Text


etc.

Not quite sure what you mean :(

What does the "A" represent? the column in which the data will change?

I have attached a stripped down version of my database
Select an employee from the list box and hit select button
This will display the detail form
If the 1st line address field is changed and then the amend button is pressed I want the amendments to be made to the data sheet for that employee record

Bob Phillips
07-20-2007, 08:42 AM
Private Sub cmdClose_Click()
Dim iRow As Long

With Worksheets("Data")
iRow = Application.Match(Val(txtPayNo.Text), .Columns(1), 0)
.Range("I" & iRow).Value = Me.TxtFirstName.Text
'and the rest
End With

Unload Me
End Sub

lifeson
07-20-2007, 10:37 AM
As usual XLD thanks a million :clap: