Replacing Filtered Results

waxb18

Board Regular
Joined
May 31, 2011
Messages
179
Im writing a macro...
So far i have applied the filter and filtered out the results i dont need to look at...

I now need to replace the contents of the results in column D with "CANX"...

This is what i have:

ActiveSheet.Range("A:Q").AutoFilter Field:=4, Criteria1:="<>CANX", _
Operator:=xlAnd, Criteria2:="<>COMP"

Range("D1").End(xlDown).Select

ActiveCell.FormulaR1C1 = "CANX"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "MS Sans Serif"
.FontStyle = "Regular"
.Size = 6
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
try

Range("D1").End(xlDown).specialcells(xlcelltypevisible).value = "CANX"

instead of SELECT and the entire last section of your code after it
 
Upvote 0
Try:

Code:
With Activesheet.Autofilter.Range
  Intersect(.Offset(1).Resize(.Rows.Count-1),Range("D:D")).SpecialCells(xlCellTypeVisible).Value = "CANX"
End With
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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