clearing cells without removing data validation

asylum

Board Regular
Joined
Dec 2, 2003
Messages
243
HI all,

I have some simple code which opens a wookbook, and pastes in data, then saves and closes it no problems.

I also have some code which opens the same workbook, selects all the data present and clears the cells (either by clear function or delete). However, either way I do this it also removes the data vaidation i have set on some of the columns.

Is there a function i can use which will allow me to remove the data, then close & save the workbook without destroying the data vaildation which i need ready for the next set of data to be pasted in?

Many thanks,

Andy
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
doh!

thanks-

i was using selection.clear, using selection.clearcontents works just fine - see i knew it was an easy solution, thanks!

Andy
 
Upvote 0

Forum statistics

Threads
1,225,136
Messages
6,183,067
Members
453,147
Latest member
Lacey D

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