Results 1 to 7 of 7

Thread: Help with filtering

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Perhaps you could add a column where you enter a number 1,2,3...etc and then run the macro using these as the criteria?, lets say column A now becomes the Index number column, now use the code below!
    [vba]
    Sub Move_Temps()
    Dim Rng As Range, MyCell As Range
    Dim strEntry As Variant
    Application.ScreenUpdating = False
    strEntry = InputBox("Enter Number(s) in this format x,x,xx?", "Index Report Selection")
    Sheets("Sheet3").Range("A1").Value = strEntry
    With Sheets("Sheet3").Range("A1")
    .TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,Comma:=True
    End With
    Set Rng = Sheets("Sheet3").Range("A1:" & Range("IV1").End(xlToLeft).Address)
    For Each MyCell In Rng
    Sheets("Sheet1").Range("A2").AutoFilter Field:=1, Criteria1:=MyCell.Value
    If MyCell.Value = "" Then GoTo Nxt
    With Sheets("Sheet1").Range("B2:" & Range("C65536").End(xlUp).Address)
    .Cells.SpecialCells(xlVisible).Copy Destination:=Sheets("Sheet2"). _
    Range("A65536").End(xlUp).Offset(1, 0)
    Application.CutCopyMode = False
    End With
    Nxt:
    ActiveSheet.AutoFilterMode = False
    Next
    Sheets("Sheet3").Cells.ClearContents
    Application.ScreenUpdating = True
    End Sub
    [/vba]Edited to tidy code up 22:21
    Last edited by BreakfastGuy; 03-13-2008 at 03:22 PM.
    Regards,
    BG.

Posting Permissions

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