Filter, Special Cells and Formula

Kinez101

New Member
Joined
Oct 18, 2016
Messages
23
I am trying to create a macro to change value of the visible cells in column Y from zCSS to zContractAdmin based on the value of column K. This is the macro I have tried to use but it's giving me error on Formula. Any help is greatly appreciated.

Code:
Sub Macro2()


    Application.CutCopyMode = False
    Selection.AutoFilter
    ActiveWindow.LargeScroll ToRight:=1
    ActiveSheet.Range("$A$1:$BR$32000").AutoFilter Field:=25, Criteria1:="zCSS"
    Columns("Y:Y").Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.SpecialCells(xlCellTypeFormula).Formula="=IF((OR(K:K="C075",K:K="C099",K:K="C170",K:K="C228",K:K="D000",K:K="D060",K:K="D113")),"zContract Admin","zCSS")"
    
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Untested but what do you get with

Code:
Sub Macro2()


    Application.CutCopyMode = False
 
    ActiveSheet.Range("$A$1:$BR$32000").AutoFilter Field:=25, Criteria1:="zCSS"
    Columns("Y:Y").SpecialCells(xlCellTypeVisible).SpecialCells(xlCellTypeFormula).Formula = "=IF((OR(K:K=""C075"",K:K=""C099"",K:K=""C170"",K:K=""C228"",K:K=""D000"",K:K=""D060"",K:K=""D113"")),""zContract Admin"",""zCSS"")"
    
End Sub
 
Upvote 0
Does the below error?
Code:
Sub Macro2()


    Application.CutCopyMode = False
 
    ActiveSheet.Range("$A$1:$BR$32000").AutoFilter Field:=25, Criteria1:="zCSS"

    Columns("Y:Y").SpecialCells(xlCellTypeVisible).SpecialCells(xlCellTypeFormulas).Formula = "=IF((OR(K:K=""C075"",K:K=""C099"",K:K=""C170"",K:K=""C228"",K:K=""D000"",K:K=""D060"",K:K=""D113"")),""zContract Admin"",""zCSS"")"

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,779
Messages
6,126,852
Members
449,345
Latest member
CharlieDP

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