Results 1 to 20 of 20

Need Help with Macro, filtering one column, and filldown value to last row of a new column

Threaded View

  1. #1
    Registered User
    Join Date
    10-31-2013
    Location
    DC
    MS-Off Ver
    Excel 2010
    Posts
    36

    Need Help with Macro, filtering one column, and filldown value to last row of a new column

    This is my first time creating a Macro, so I apologize if I sound newbish.

    I'm creating a macro that allows me to filter out certain values in a column.
    I would then have to insert a new column, and enter either Yes or No in that same column, and I would like it to fill all the way down to the last row of that column (and the number of rows changes upon utilization of another worksheet)
    I would have to repeat this step for the next 2 columns that I need to filter out.

    So for instance, Filter column R and deselect some of the values. Insert a new columnin column B. Type "No" in that column and have it fill to the last row of the column.

    My problem is, when I'm opening another worksheet to test to see if it works, the column with either Yes or No, follows the same pattern as the the worksheet where I've created the macro itself. Here is my code:

    Sub DatatapeException()
    '
    ' DatatapeException Macro
    ' Macro for datatape exception
    '
    ' Keyboard Shortcut: Ctrl+Shift+M
    '
        Columns("A:A").Select
        Selection.NumberFormat = "0"
        Columns("B:B").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("B1").Select
        ActiveCell.FormulaR1C1 = "Boardable?"
        Range("A1").Select
        Selection.AutoFilter
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=15, Criteria1:= _
            "=Attachment does not exist in document place holder", Operator:=xlOr, _
            Criteria2:="=Document place holder does not exist"
        Range("B5").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B6").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B14").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B17").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B19").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B25").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B36").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B39").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B41").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B43").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B45").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B54").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B57").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B65").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B73").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B75").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B85").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B95").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B96").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B102").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B110").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B113").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B114").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B115").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B118").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B119").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B123").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B126").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B128").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B131").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B134").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B144").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B145").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B148").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B161").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B162").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B163").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B164").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B168").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B170").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B173").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B180").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B181").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B185").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B189").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B190").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B193").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B199").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B202").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B199").Select
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=15
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=13, Criteria1:=Array( _
            "Attachment does not exist in document place holder", _
            "Document place holder does not exist", _
            "More than one current version files exist in the document"), Operator:= _
            xlFilterValues
        Range("B12").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B101").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B111").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B159").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B175").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B195").Select
        ActiveCell.FormulaR1C1 = "N"
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=13
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=12, Criteria1:=Array( _
            "Attachment does not exist in document place holder", _
            "Document place holder does not exist", _
            "Multiple documents exist with current version files"), Operator:= _
            xlFilterValues
        Range("B11").Select
        ActiveCell.FormulaR1C1 = "N"
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=12
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=6, Criteria1:=Array( _
            "Attachment does not exist in document place holder", _
            "Document place holder does not exist", _
            "More than one current version files exist in the document"), Operator:= _
            xlFilterValues
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=3, Criteria1:=Array( _
            "InterestRateReductionRefinanceLoan", "StreamlineWithAppraisal", _
            "StreamlineWithoutAppraisal"), Operator:=xlFilterValues
        Range("B10").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B84").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B93").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B146").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B151").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B192").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B194").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B200").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B201").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("B209").Select
        ActiveCell.FormulaR1C1 = "N"
        Range("C1").Select
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=3
        Range("F1").Select
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=6
        Range("E12").Select
        Sheets.Add After:=Sheets(Sheets.Count)
        Sheets("Sheet1").Select
        Sheets("Sheet1").Name = "Boarded"
        Sheets.Add After:=Sheets(Sheets.Count)
        Sheets("Sheet2").Select
        Sheets("Sheet2").Name = "Exception"
        Sheets("Boarded").Select
        With ActiveWorkbook.Sheets("Boarded").Tab
            .ThemeColor = xlThemeColorAccent6
            .TintAndShade = 0
        End With
        Sheets("Exception").Select
        With ActiveWorkbook.Sheets("Exception").Tab
            .Color = 255
            .TintAndShade = 0
        End With
        Range("C29").Select
        Sheets("10-9").Select
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=2, Criteria1:="<>"
        Cells.Select
        Selection.Copy
        Sheets("Exception").Select
        Range("A1").Select
        ActiveSheet.Paste
        Sheets("10-9").Select
        Range("C12").Select
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = ""
        ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=2, Criteria1:="="
        Cells.Select
        Selection.Copy
        Sheets("Boarded").Select
        Range("A1").Select
        ActiveSheet.Paste
        Cells.Select
        Cells.EntireColumn.AutoFit
        Range("E7").Select
        Sheets("10-9").Select
        Range("C18").Select
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = ""
        Range("G8").Select
        Selection.AutoFilter
        Range("F9").Select
    End Sub

    Please help.
    Last edited by mDevel; 10-31-2013 at 03:19 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to show Which macro didnt work in a nested macro
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2013, 03:21 AM
  2. Perform macro "on open" specific file- store macro in Personal Macro Workbook?
    By thompssc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 12:38 PM
  3. lookup macro, solver macro, realtime macro
    By xelhelp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2011, 06:14 PM
  4. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 AM
  5. [SOLVED] Macro calling another Macro: "The macro 'Personal.xls!FindChar"
    By William Benson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1