Update Sheet from update in textbox

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,227
Office Version
  1. 2010
Platform
  1. Windows
Hi i hope you can help, i have a userform with a listbox which highlights the data in sheet1, when click on one of the rows in the listbox this populates the data into the textbox, but i am stuck as if i want to update the data by changing it in the textbox, i want to click on my update button to update the data in sheet1. please see attached my spreadsheet on dropbox, i hope you can help me please?

listbox view in userform(1).xlsm
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
there are 5 textboxes - textbox1, textbox2, textbox3, textbox4, textbox5
 
Upvote 0
Hi any help on this please? i am really stuck on this and don't know where to go regarding the update button.
 
Upvote 0
Hi I have sort of got it to work now it updates the lsitbox now but how do i direct it to update sheet1 please in the code below?
VBA Code:
Private Sub cmdUpdate_Click()
    If ListBox1.ListIndex <> -1 Then
        With ListBox1
            .List(.ListIndex, 0) = TextBox1.Value
            .List(.ListIndex, 1) = TextBox2.Value
            .List(.ListIndex, 2) = TextBox3.Value
            .List(.ListIndex, 3) = TextBox4.Value
            .List(.ListIndex, 4) = TextBox5.Value
        End With
    End If
End Sub
 
Upvote 0
Hi i have got it to update the ListBox but please can you advise how i get it to update Sheet1 instead?
Code:
Private Sub cmdUpdate_Click()
    If ListBox1.ListIndex <> -1 Then
        With ListBox1
            .List(.ListIndex, 0) = TextBox1.Value
            .List(.ListIndex, 1) = TextBox2.Value
            .List(.ListIndex, 2) = TextBox3.Value
            .List(.ListIndex, 3) = TextBox4.Value
            .List(.ListIndex, 4) = TextBox5.Value
        End With
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,589
Messages
6,120,415
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top