Insert into visible cells only if there are visible cells

jordanburch

Active Member
Joined
Jun 10, 2016
Messages
440
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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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