Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear specified cells

Status
Not open for further replies.

ali32j

Technical User
Apr 23, 2007
97
0
0
GB
Hi All

I am looking to automate a process using a button press macro in excel, upon pressing the button it will clear all data in specified cell range (B2 to E2500), can anyone help me with the coding to place on the command button?

Thanks

Ali
 
In your command button's click event use:
Code:
Range("B2:E2500").ClearContents
Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Thankyou thats perfect

One other questions, is it possible to automatically enter a formula in a cell if a value is present? i am trying to automate the process to prevent user mistakes, so in column AA, if value present in column Z, then paste formula, if no value then stop
 
ali32j,

Please start a new thread for a new question unrealted to the thread.

You might also click the link...
[blue]
Thank HarleyQuinn
for this valuable post!
[/blue]


Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hmm, I don't have that link on my screen Skip... [tongue]

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 



we'll leave the self agrandizing to the pub, after hours, and quaff a pint on me. ;-)

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
[cheers]

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top