Can we disable the AutoFill functionality on certain cells only ?

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
9,621
Office Version
  1. 2016
Platform
  1. Windows
Hi.

I want to prevent copying onto some specific cells when holding and dragging adjacent cells . In other words not to allow AutoFilling should those specific cells come within range of the autofill area.

Disabling the AutoFill functionality via ( Tools>Options>Edit>Allow Cell Drag and Drop ) is not an option because this applies to the entire application. I only need this on specific cells and want to keep the AutoFill feature for the rest of the worksheet.

I have been playing around with some code but it is proving more difficult than I initially thought unless I am missing something.

Any ideas ?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Ok nevermind . I found a stable workaround by dinamically Protecting and UnProtecting the worksheet in the Worksheet_SelectionChange event handler.
 
Upvote 0
Oops ! I think I spoke too soon.

Toggling the sheet protection as mentioned in the previous post is proving problematic because it has the side effect of reseting the Clipboard and I can no longer copy and paste .

So Problem not solved.

Is there a solution to this without having to protect the sheet ?
 
Upvote 0
It's not the toggling that generates the side effect of reseting the Clipboard ... it's just running the event macro ( with or without the toggling ) that has that side effect. I don't know of a way around it either.
 
Upvote 0
It's not the toggling that generates the side effect of reseting the Clipboard ... it's just running the event macro ( with or without the toggling ) that has that side effect. I don't know of a way around it either.

Thanks Glenn.

I didn't experience that.

I don't get the clipboard reset just by running the event macro. Even editing cells and making other changes to other excel objects within the event doesn't in fact reset the Clipboard.
 
Upvote 0
Why don't you just permanently protect the worksheet after unlocking the cells you want the user to be able to change?
 
Upvote 0
Why don't you just permanently protect the worksheet after unlocking the cells you want the user to be able to change?

Having the cells unlocked won't prevent the autofill from overriding their contents.

Thanks.
 
Upvote 0
Why do you want to prevent autofilling on unlocked cells? You mentioned that you were toggling protection. Why not just keep protection on?
 
Upvote 0
Why don't you just permanently protect the worksheet after unlocking the cells you want the user to be able to change?

Ok maybe I didn't explain myself clearly enough.

I dont want to allow the contents of the cells to be erased by the AutoFill but still allow the user to edit the cells.

The reason is that those cells contain Data validation and/or Conditional Formatting.

Normal Copy and paste erases the contents of the cells as well but I have that scenario already handled.
 
Upvote 0

Forum statistics

Threads
1,215,472
Messages
6,125,003
Members
449,203
Latest member
Daymo66

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