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 TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting multiple ranges at once

Status
Not open for further replies.

nangel

Automotive
Joined
Dec 7, 2004
Messages
10
Location
US
I would like to delete multiple ranges from multiple spreadsheets at once.

Example:
A workgroup has three Spreadsheets

Sheet 1:
delete the range from c4 to c53 and f4 to f53.
Sheet 2:
Delete the range from c62 to d84
Sheet 3:
Delete the range from a11 to d3 and f2 to k70

I would like to delete all of this ranges by click a button in the spreadsheet. Please advise how I may accomplish this.

Thank you very much!
 
For simple VBA like this just record a macro, then open the macro for editing so you can see how it works

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

UK steam enthusiasts:
 
Add a button control where desired within the workbook containing the cells to be cleared. Be sure to use the control toolbox to add the button. Add the following code to the worksheet code pane containing the button.


Private Sub CommandButton1_Click()
Sheet1.Range("C4:C53,F4:F53").ClearContents
Sheet2.Range("C62:D84").ClearContents
Sheet3.Range("A11:D3,F2:K70").ClearContents
End Sub
 
Thank you very much cummings54 for taking the time a create the code for this task. I really appreciate it very much. It is working just fine. Thank you!

Thank you johnwm for your comments.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top