Hi,
I have a text box which populates values from a range.
The text box is locked by default.
Once user clicks on an edit button, user will be able to change the value in the text box.
And after changing, once user clicks on one Save button, I need the new value to be updated in the excel sheet in the exact position.
Here is the code that I'm using.
Private Sub Members_Click()
ContactForm.teamName.Text = ""
Dim myCell As Variant, myIndex As Integer
Dim teamRng As Range, nameRng As Range
Set nameRng = ContactWorkBook.ActiveSheet.Range("myName")
Set teamRng = ContactWorkBook.ActiveSheet.Range("teamName")
myIndex = 0
For Each myCell In nameRng.Cells
myIndex = myIndex + 1
If myCell = Members.Text Then
ContactForm.editTeam.Enabled = True 'The Edit button will be enabled here
ContactForm.teamName.Value = teamRng(myIndex)
If IsEmpty(teamRng(myIndex)) Then
ContactForm.teamName.Value = "NA"
End If
End If
Next
As mentioned above, when user clicks an Edit button, the textbox teamName will be editable, and user can change values in it.
There is also another Save button. I want the exact position in the excel sheet to be updated when user clicks save button in user form.
Best Regards
Sivakumar
Bookmarks