HELP - Button to clear content in a cell range

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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
 
Upvote 0
Not a big deal, but you could do both ranges in one go:
Code:
Range("G15:G197,J15:J197").ClearContents
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

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