+ Reply to Thread
Results 1 to 4 of 4

Basic Last row query

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Wink Basic Last row query

    Hi i need a formula to

    Select A1:K1 & Lastrow

        Dim Lastrow As Long
        Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    
        Selection.AutoFilter Field:=11, Criteria1:="=A", Operator:=xlOr, _
        Criteria2:="=BJ"
        
        Range("A1:K1" & Lastrow).Select
    I have tried the above but it doesnt work it selects a1:k1 but then selects all the cells down to end of the excel document where as the data in cell a ends at row 500 (this can very depending on which sheets i am using).. any help .. ? my vb knowledge is basic but improving


    would this work better ? Range("A1").CurrentRegion.Select

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Use


    Range("A1:K" & Lastrow).Select

  3. #3
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Wink thanks

    thanks for the help once again

  4. #4
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Unhappy Basic query re advanced filters

        'Academy
        Sheets("CSC").Select
        Range("S1000").Select
        ActiveCell.FormulaR1C1 = "Department"
        Range("S1001").Select
        ActiveCell.FormulaR1C1 = "ACADEMY"
        
        Range("T1000").Select
        ActiveCell.FormulaR1C1 = "CSR CATEGORY"
        Range("T1001").Select
        ActiveCell.FormulaR1C1 = "A"
        Range("T1002").Select
        ActiveCell.FormulaR1C1 = "D"
        
        Range("K1:K300").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
        Range("T1000:T1002"), Unique:=False
        
        Range("I1:I300").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
        "U1000:U1007"), Unique:=True
    Can i do 2 advanced filters

    Ie ADVANCED FILTER filters the data then I want to filter it futher agaoin.

    I have the above code but Range("I1:I300").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
    "U1000:U1007"), Unique:=True always resets the first filter and then displays the results

    for example coloum I shows : john , peter , ian, dev , mark
    after filter one it shows john , peter only
    I need these unique names , but when filter 2 takes place it displays john , peter , ian, dev , mark
    instead of john , peter only

    I hope this makes sense, I pray there is an easy fix

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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