• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel VBA Code to Update Last row of any sheet which can be selected from list box

kl_ravi

New Member
I am having a Database of Some Acts/Rules (in index page) and relevant data spread across 100 sheets. The data from Index Sheet is automatically displayed in the first listbox. Selecting any of the items in the listbox populates the data in 2nd list box. Double clicking on the last item in the list box transfers the data to couple of textboxes.

Now I need to find a way to update the last row of the sheet which was selected from the 1st listbox (ListIndex)
I hope to achieve this by typing updated values into the text box and clicking the "Submit" button.
The code for Submit button is mentioned below. However this is not working as I expected.
I request any Help to resolve the issue.

Code:
Sub Submit()
Dim sh As Worksheet
Dim irow As Long
    Set sh = ThisWorkbook.Sheets((lstIndex.List(lstIndex.ListIndex) + 2))
    Application.EnableEvents = False
    sh.Activate
    irow = Cells(Rows.Count, "E").End(xlUp).Row + 1
    With sh
.Cells(irow, 5) = frmMain.txtGSR.value
.Cells(irow, 7) = frmMain.txtDate.value
    End With
    Application.EnableEvents = True
End Sub
 

Attachments

  • Central & State Acts and Rules.xlsm
    685.2 KB · Views: 6
Back
Top