Geekamo
asked on
"CLEAR" Macro
Hello Experts!
I have a spreadsheet, that calculates figures for me on a daily basis. Each day, I end up clearing out specific cells and/or ranges to bring the spreadsheet back to Day 1.
What would be the macro/code I could copy and paste into my spreadsheet (Yes, I know where to paste a macro, I just don't have a clue how to write it) to clear specific cells & ranges.
IE - I am going to add a button to my spreadsheet, that when pressed does the following...
1.) "Clear Contents" of range E:I
2.) "Clear Contents" of range C7:C8
3.) "Clear Contents" of cell C10
Is this possible?
Thank you in advance for your help!
~ Geekamo
I have a spreadsheet, that calculates figures for me on a daily basis. Each day, I end up clearing out specific cells and/or ranges to bring the spreadsheet back to Day 1.
What would be the macro/code I could copy and paste into my spreadsheet (Yes, I know where to paste a macro, I just don't have a clue how to write it) to clear specific cells & ranges.
IE - I am going to add a button to my spreadsheet, that when pressed does the following...
1.) "Clear Contents" of range E:I
2.) "Clear Contents" of range C7:C8
3.) "Clear Contents" of cell C10
Is this possible?
Thank you in advance for your help!
~ Geekamo
Sorry.
Range("E:I").Select
Selection.ClearContents
Range("E:I").Select
Selection.ClearContents
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
After inserting command button into worksheet, say (sheet1),
then double click on the inserted command button and write code and it will look like this,
Private Sub CommandButton1_Click()
Sheet1.Select
Columns("E:I").Select
Selection.ClearContents
Range("C7:C8").Select
Selection.ClearContents
Range("C10").Select
Selection.ClearContents
End Sub
Now if you click the command button, then you will find the code will do the real magic for you.
hope this helps.
then double click on the inserted command button and write code and it will look like this,
Private Sub CommandButton1_Click()
Sheet1.Select
Columns("E:I").Select
Selection.ClearContents
Range("C7:C8").Select
Selection.ClearContents
Range("C10").Select
Selection.ClearContents
End Sub
Now if you click the command button, then you will find the code will do the real magic for you.
hope this helps.
ASKER
@ ssaqibh
Thank you very much! Your line of code worked beautifully.
@ everyone
Thank you all for your input.
~ Geekamo
Thank you very much! Your line of code worked beautifully.
@ everyone
Thank you all for your input.
~ Geekamo
Selection.ClearContents