Update Worksheet data from a user form

Eurekaonide

Active Member
Joined
Feb 1, 2010
Messages
433
Dear All

I have some controls namely Text Box's , Combo Box's and List Box's on a user form and I want the user to be able to update data in these and the updates be posted back to the correct cell in the worksheet.

My First ListBox the user chooses the line (Row) in which the updates will be posted to. Therefore How do i get the other controls on the user form to relate back to this same row (different columns) ? All I seem to be able to do is get it to populate to the next empty row :confused:
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try along the lines of

Code:
Range("A" & listbox1.Value) = combobox1.Value
 
Upvote 0
Do I need to declare anything to use this as it does not seem to want to work?

The code I am using to populate the data to the next empty row looks like this;

HTML:
Cells(NextRow, 33) = Combobox17.Value

The NextRow Count is set as an Application Worksheet function of COUNTA

but if I replace the above with what you suggetsed it does not work :confused:
 
Upvote 0
To test I created a userform with one listbox, one combobox and one command button. Code for the command button

Code:
Private Sub CommandButton1_Click()
Range("A" & ListBox1.Value).Value = ComboBox1.Value
End Sub

On selecting a row number in the listbox and a value in the combobox, clicking the command button placed the value in the correct cell.

If nothing is selected in the listbox you'll get an error.
 
Upvote 0
So what sort of values do you have in the listbox and how do they relate to row numbers?
 
Upvote 0
maybe this is the issue; What is populated in the first listbox is the text in the cells of the worksheet under a named range of 'ProjectName'

What I would like is that when the user selects one of these Project names in the list box any of the other updates they maek in the user form list boxes, text boxes etc get populated in the cells within the same row as the 'ProjectName' aka ListBox1 data.
 
Upvote 0
This worked for me

Code:
Private Sub CommandButton1_Click()
Dim iRow As Long
iRow = Range("ProjectName").Find(what:=ListBox1.Value, LookIn:=xlValues, lookat:=xlWhole).Row
Range("A" & iRow).Value = ComboBox1.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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