Skip code if no blanks are found

Justplainj

New Member
Joined
Apr 15, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have the following code to find blank cells in a specific range (Column A and Row 1 will never have blank cells but the rest might)
After finding blanks it must replace it with a zero.
However if it does not find blank cells it must continue with the rest of the VBA code I have.

VBA Code:
    Sheets("Active Dev").Select
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeBlanks).Select
    Selection.FormulaR1C1 = "0"

How do I allow the code to continue if no blanks are found?
Note: This is a small part of several sheets that is checked with the same VBA code, before the sheets are copied and pasted into one sheet.

Thanks in advance.
J
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Justplainj

New Member
Joined
Apr 15, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Solved.

I amended the code to the following.

VBA Code:
On Error Resume Next
    Sheets("Active Dev").Select
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeBlanks).Value = "0"

Thanks
 
Solution

Forum statistics

Threads
1,143,619
Messages
5,719,772
Members
422,244
Latest member
AYSHANA

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