Listbox to insert data to selected line

vhdhfox

New Member
Joined
Aug 6, 2020
Messages
36
Office Version
  1. 2013
Platform
  1. Windows
Hi

currently I have a userform with a listbox that displays the data I've selected in textboxes but whatever code I try to insert the new data to either the listbox or cells of the highlighted line in the list box I get error "70" listbox does not have permission.

1597138917425.png
 
Okay so I've been playing around with other ideas instead of using rowsource and decided to go with the below code which works fairly well for what I want as I have lined the columns up with the textboxes above the listbox

VBA Code:
Sub UserForm_Initialize()

    Dim rngMultiColumn As Range
Set rngMultiColumn = ThisWorkbook.Worksheets("Allocate").Range("A2:O13")
With AllocateFitler.AllocateBox1
.ColumnWidths = "40;40;60;95;30;30;30;90;60;70;75;85;30"
.List = rngMultiColumn.Cells.Value
End With

End Sub

im just having trouble with inserting these lines once the data has been updated I.E. when someone selects a line in the listbox they can then update that data or add values in textbox 1,2,5.

im not sure if its possible but I would like to be able to have a command button that either deletes or replaces the data on the worksheet the data is stored based on what row in the listbox is selected.

Thanks for your help and apologies for the late reply Rory
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Since your data starts in row 2 and the listbox's ListIndex property starts at 0, all you need to do to get the correct row number for the cells is add 2 to the Listindex.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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