***Clear cells only data not the formatting

Rehaan Syeed

New Member
Joined
Jun 18, 2011
Messages
45
hi

i want to know how can we clear cells without clearing the format or validation putted in the perticular cell (cells) with the help of a macro

i have tried doing with the below macro but itz deletng the validations as well can and one help me with that

USED macro

Sub clear_contant()
range("A1:A5").clearcontant
End_sub


thanks

Rehaan Syeed
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
This clears only the contents, not the formatting or data validation (tested in Excel 2010)

Code:
Sub clear_contant()
Range("A1:A5").ClearContents
End Sub
 
Upvote 0
i tried it but itz still coming out with the same result.

the A1 to A5 cell references holds validations as well but i juzz wanna make those cells empty without deleting the validations assigned
 
Upvote 0
Before the macro

Excel Workbook
A
1Y
2N
3N
4N
5Y
Sheet1
#VALUE!




After the macro


Excel Workbook
A
1
2
3
4
5
Sheet1
#VALUE!
 
Upvote 0
Hi Peter

Iam a New User to this site this is a very good site with a quick replies to our quries.

can u help me with the consolidation macro. i mean a macro which consolidates the multiple excel workbook into one workbook sheet if we give path to that macro from which folder it should take the data.

thanks
Rehaan Syeed
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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