Syed,
Are you saying that you populate a list from columns; in excel worksheet and
then edit these columns in worksheets using this list box ?
If that is the case then You can user range object of worksheet to point to
a particular cell.
Array value from this code that updates the list box can be passed to the
cell reference and that will update list box as well as cell in worksheet.
application.worksheets(name of worksheet).range( refer to cell with 'col A'
and 'Row i' here).value = sNewValueCol1
application.worksheets(name of worksheet).range( refer to cell with 'col B'
and 'Row i' here).value = sNewValueCol2
Hope this helps
Nayan
- Show quoted text -
Dear Mr. Nayan,
I am very happy to see that you sent me reply within one hour. I
appreciated ...
Sir, the code you sent, I checked but it is not working in my form.
May be I am doing some thing wrong.
Actually I have a Worksheet name is DATA, having Inventory Data from
A2:M99
and I have a userform1, showing one combobox1 and other textboxes to
display the data. I am using combobox to retrive data, by using this
code:
Option Explicit
Dim i As Integer
Private Sub ComboBox1_Change()
i = ComboBox1.ListIndex
TextBox1.Value = ComboBox1.Column(1, i) 'This is column B
TextBox2.Value = ComboBox1.Column(2, i) 'This is column C
TextBox3.Value = ComboBox1.Column(3, i) 'This is column D
TextBox4.Value = ComboBox1.Column(4, i) 'This is column E
TextBox5.Value = ComboBox1.Column(5, i) 'This is column F
TextBox6.Value = ComboBox1.Column(6, i) 'This is column G
TextBox7.Value = ComboBox1.Column(7, i) 'This is column H
TextBox8.Value = ComboBox1.Column(8, i) 'This is column I
TextBox9.Value = ComboBox1.Column(9, i) 'This is column J
TextBox10.Value = ComboBox1.Column(10, i) 'This is column K
TextBox11.Value = ComboBox1.Column(11, i) 'This is column L
TextBox12.Value = ComboBox1.Column(12, i) 'This is column M
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
ComboBox1.SetFocus
ComboBox1.RowSource = "A2:N99"
End Sub
NOW, the problem is this after retriving my records from the
worksheet, I am unable to Edit, if I want to change any record
(textbox) how I can Edit my records in userform and the worksheet at
the same time.
this is my big problem.
If you send me the solution, I will be highly appreciated.
Very sorry to distrub you again and again.
Thanks and regards.
Syed Shahzad Zafar
Madinah - KSA