Prevent manual input to cell but allow input from Listbox

AdrianNeal

New Member
Joined
Mar 22, 2019
Messages
5
Hi
i have sheet that allows the user to input data into a cell from selecting it from a Listbox on Userform. The values in the Listbox are from a named Range.
But the user can still manually write directly into the cell and can therefore input any value, even if its not in the named range, and I don’t want them to be able to do that.
is there a away ?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You could use data validation on the cell using the same named range
 
Upvote 0
You must protect the sheet. Lock the cell.
Then in the code to pass the listbox data to the sheet, you must unprotect the sheet, put the data and re-protect the sheet.

eg.

Code:
    ActiveSheet.Unprotect
    Range("D10").Value = ListBox1.Value
    ActiveSheet.Protect
 
Upvote 0
thanks guys,
came to a similar conclusion last night, But I decided to block the user from manual data entry with

ActiveSheet.Protect UserInterfaceOnly:=True
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,580
Members
449,039
Latest member
Arbind kumar

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