Clearing content where formula returns blank value

Declamatory

Active Member
Joined
Nov 6, 2014
Messages
319
Good afternoon,

I have a workbook that has 7 sheets. The first three sheets named Order, Order Allocation and Order Allocation Charge. There is data in these three sheets that use formulas to look at data in the last four sheets to create orders that are to imported to our operating system. The import fails if a formula returns a blank value e.g. there are 10 orders but row 11 is blank (but contains formulas).

We would not have more than 200 orders in a day.

Is there a way of using vba to clear the contents of cells A1:R200 where the value is blank?

I found this on the web and it does work but only does one column.

Sub ClearCell()
Dim Rng As Range
Set Rng = ActiveSheet.Range("A1")

Dim i As Long
For i = 1 To 200
If Rng.Cells(i, 1) = "" Then
Rng.Cells(i, 1).ClearContents
End If
Next i
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,236
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Sub Declamatory()
   Dim Cl As Range
   
   For Each Cl In ActiveSheet.UsedRange.SpecialCells(xlFormulas, xlTextValues)
      If Cl.Value = "" Then Cl.ClearContents
   Next Cl
End Sub
 
Solution

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,236
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,141,048
Messages
5,703,928
Members
421,321
Latest member
blusky4

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