Simple ClearContents not working

ColinCoady

New Member
Joined
Mar 21, 2019
Messages
35
I can't figure out why this won't work. Can someone take a look?

Code:
Private Sub ClearContents()
Worksheets("Costing").Activate
If Cells(7, 5).Value = "Other %" Then Cells(7, 7).ClearContents
End Sub
 
I can't figure out why this won't work. Can someone take a look?

Code:
Private Sub ClearContents()
Worksheets("Costing").Activate
If Cells(7, 5).Value = "Other %" Then Cells(7, 7).ClearContents
End Sub
Describer "won't work" for us... what exactly happens?
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
What does this formula return?
=CODE(RIGHT(E7))
 
Upvote 0
Hi

Where is this code, in a sheet module or in a general module?

If it's in a sheet module use instead:

Code:
Private Sub ClearContents()

If Worksheets("Costing").Cells(7, 5).Value = "Other %" Then Worksheets("Costing").Cells(7, 7).ClearContents
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,076
Messages
6,128,669
Members
449,463
Latest member
Jojomen56

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