Insert into visible cells only if there are visible cells

jordanburch

Active Member
Joined
Jun 10, 2016
Messages
309
Office Version
  1. 2016
Hey Guys,

I have the following
Columns("J:J").Select
Range("aj2:aj6000").SpecialCells(xlCellTypeVisible).Formula = "COMPLETE"

Range("AM71").Select
Range("al2:al6000").SpecialCells(xlCellTypeVisible).Formula = "OFF SET"

Range("AL78").Select

it works great but only if there are cells that are selected when filtered
Columns("Au:Au").Select
Selection.Style = "Currency"
ActiveSheet.Range("$A$1:$AY$6000").AutoFilter Field:=47, Criteria1:= _
"=$(0.00)", Operator:=xlOr, Criteria2:="=$-"
sometimes there wont be any results though. It then errors out saying that there arent any cells to be inserted into because there wasnt anything in the selection. How can I code around this?

Jordan
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Fluff

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

Watch MrExcel Video

Forum statistics

Threads
1,129,344
Messages
5,635,751
Members
416,877
Latest member
SolarTheory

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