+ Reply to Thread
Results 1 to 3 of 3

how can ListIndex can be pass when botton click

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-12-2010
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    134

    how can ListIndex can be pass when botton click

    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.
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: how can ListIndex can be pass when botton click

    That code is not in the Modify button.

    Please explain clearly what you want to do
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    02-12-2010
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    134

    Re: how can ListIndex can be pass when botton click

    hi RoyUK
    as u can find in my UF_list
    i need to select the raw in list box those value papulate the taxt box till this code work
    but if i change the value in taxt box and click the Modify & return button code change the very first raw of data set ie A2 to I2 but not changing the same selected raw from the list box
    i hope i am explaining my need.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1