HELP - Button to clear content in a cell range

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

SteveO59L

Well-known Member
Joined
Apr 21, 2004
Messages
7,896
Create your button from the Forms toolbar.

In design mode, selct the button, right click and select the view code option.

Then paste the two lines between the Sub/End Sub
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Not a big deal, but you could do both ranges in one go:
Code:
Range("G15:G197,J15:J197").ClearContents
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
Create your button from the Forms toolbar.

In design mode, selct the button, right click and select the view code option.

Then paste the two lines between the Sub/End Sub
Forms toolbar or Control Toolbox?
 

mauricelopes

New Member
Joined
Nov 30, 2009
Messages
9

ADVERTISEMENT

im new at this, i just aded the following, can i add the button to clear in the same macro ? if so can you please tell me how, thanks.

Sub try()
x = 15
Do Until x = 198
If Cells(x, 6) = 0 And Cells(x, 7) = 0 Then
Rows(x).Hidden = True
End If
x = x + 1
Loop
End Sub

Sub undotry()
Rows("15:197").Hidden = False
End Sub
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
i just aded the following, can i add the button to clear in the same macro?
I'm not sure just what you are asking, as you actually have two macros. Can you explain in a bit more detail just what you are trying to do?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,329
Members
414,055
Latest member
mcarduner

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
Top