hi
i find this user form in this forum and i change to my need but it "Modify & Return"
button not work. As it suppose to change the same raw of sheet as in
list box 1 raw .insted of it change 2nd raw every time if u change the value in any textBox
but ineed to change the same raw which is selected in listbox.
Private Sub CommandButton2_Click()
'Modify list and return to Page1
var1 = 1
Sheet1.Range("A2").Offset(ListBox1.ListIndex, 0).Value = ComboBox1
Sheet1.Range("B2").Offset(ListBox1.ListIndex, 0).Value = TextBox1
Sheet1.Range("C2").Offset(ListBox1.ListIndex, 0).Value = TextBox2
Sheet1.Range("D2").Offset(ListBox1.ListIndex, 0).Value = Val(TextBox3)
Sheet1.Range("E2").Offset(ListBox1.ListIndex, 0).Value = Val(TextBox4)
Sheet1.Range("F2").Offset(ListBox1.ListIndex, 0).Value = ComboBox2
TextBox7 = Round((TextBox4.Value / TextBox3.Value), 2)
TextBox6 = Round(TextBox7, 2)
Sheet1.Range("G2").Offset(ListBox1.ListIndex, 0).Value = TextBox5
Sheet1.Range("H2").Offset(ListBox1.ListIndex, 0).Value = Val(TextBox6)
'Sheet1.Range("H2").Offset(ListBox1.ListIndex, 0).Value = Val(TextBox7)
Sheet1.Range("I2").Offset(ListBox1.ListIndex, 0).FormulaR1C1 = "=RC[-4]/RC[-5]"
var1 = Empty
ListBox1.TopIndex = ListBox1.ListIndex 'returns to same place on ListBox1
ListBox1.ListIndex = -1 'turns off selection on ListBox1
MultiPage1.Pages(0).Enabled = True
UF_List.MultiPage1.Value = 0
MultiPage1.Pages(1).Enabled = False
End Sub
any help is appreciated.
Bookmarks