Wish I could solve this Clear Range Problem

microhunt

Board Regular
Joined
Aug 14, 2017
Messages
60
Office Version
  1. 2021
Platform
  1. Windows
I am using the code below to clear cells when I run Macro. The problem my sheet is very long for example. I am clearing every fourth cell in column C starting at C5 and finishing at C1653. I do not want to clear any other cells in this column.

I posted this yesterday and a very kind person nearly give me a fix using the code below which did work but also clear other formulas in column C. The code he give me was as follows:

Code:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Sub ClearFishSheet(sWorksheet As String)
  Sheets(sWorksheet).Range("C5:C1653") = Evaluate("IF(MOD(ROW('" & Sheets(sWorksheet).Name & "'!C5:C1653)-5,4),'" & Sheets(sWorksheet).Name & "'!C5:C1653,"""")")
End Sub[/TD]
[/TR]
</tbody>[/TABLE]
[/QUOTE]

Sub Clearrange(sRange As String, sWorksheet As String)

Worksheets(sWorksheet).Range(sRange).ClearContents
End Sub
Sub ClearFishSheet(sWorksheet As String)



Code:
[COLOR=#333333]Clearrange ("C5"), sWorksheet ' Range 1[/COLOR]
[COLOR=#333333]Clearrange ("C9"), sWorksheet ' Range 2[/COLOR]
[COLOR=#333333]Clearrange ("C13"), sWorksheet ' Range 3[/COLOR]
[COLOR=#333333]Clearrange ("C17"), sWorksheet ' Range 4[/COLOR]
[COLOR=#333333]Clearrange ("C21"), sWorksheet ' Range 5[/COLOR]
[COLOR=#333333]Clearrange ("C25"), sWorksheet ' Range 6[/COLOR]
[COLOR=#333333]Clearrange ("C29"), sWorksheet ' Range 7[/COLOR]
[COLOR=#333333]Clearrange ("C33"), sWorksheet ' Range 8[/COLOR]
[COLOR=#333333]Clearrange ("C37"), sWorksheet ' Range 9[/COLOR]
[COLOR=#333333]Clearrange ("C41"), sWorksheet ' Range 10[/COLOR]
[COLOR=#333333]Clearrange ("C45"), sWorksheet ' Range 11[/COLOR]
[COLOR=#333333]Clearrange ("C49"), sWorksheet ' Range 12[/COLOR]
[COLOR=#333333]Clearrange ("C53"), sWorksheet ' Range 13[/COLOR]
[COLOR=#333333]Clearrange ("C57"), sWorksheet ' Range 14[/COLOR]
[COLOR=#333333]Clearrange ("C61"), sWorksheet ' Range 15[/COLOR]
[COLOR=#333333]Clearrange ("C65"), sWorksheet ' Range 16[/COLOR]
[COLOR=#333333]Clearrange ("C69"), sWorksheet ' Range 17[/COLOR]
[COLOR=#333333]Clearrange ("C73"), sWorksheet ' Range 18[/COLOR]
[COLOR=#333333]Clearrange ("C77"), sWorksheet ' Range 19[/COLOR]
[COLOR=#333333]Clearrange ("C81"), sWorksheet ' Range 20[/COLOR]
[COLOR=#333333]Clearrange ("C85"), sWorksheet ' Range 21[/COLOR]
[COLOR=#333333]Clearrange ("C89"), sWorksheet ' Range 22[/COLOR]
[COLOR=#333333]Clearrange ("C93"), sWorksheet ' Range 23[/COLOR]
[COLOR=#333333]Clearrange ("C97"), sWorksheet ' Range 24[/COLOR]
[COLOR=#333333]Clearrange ("C101"), sWorksheet ' Range 25
[/COLOR]
[/QUOTE]

I would really appreciate help with this. I apologise in advance if I have broken any forum rules by posting

:confused:
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,896
Messages
6,127,626
Members
449,391
Latest member
Kersh82

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