Results 1 to 4 of 4

Thread: Filtering and then copying

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2006
    Posts
    25

    Filtering and then copying

    I am having problems with my VB language. I have a data set which I then filter to get the data elements I need. I am having a problem with offsetting (scrolling down) from the column labels to the first row of applicable data.

    So Cell "A4" is the start of the column headings. When I filter the data, the first row of data showing is in row 41.

    What language do I use to go scroll down from A4 to A41? so I can then select the data elements I need.

    Thanks

  2. #2
    New Member RaytracerFFM's Avatar
    Join Date
    Jun 2010
    Location
    Frankfurt, Germany
    Posts
    15

    Re: Filtering and then copying

    hi jeff,

    maybe some code or the scenario to illustrate what you are trying to do?

    Guessing here, but if you're trying to offset and select a cell in Excel via VB, maybe this helps:

    Test1 offsets cell A4 by 37 rows and selects it
    Test2 offsets cell A4 by 37 rows, gets its address and outputs it in a MsgBox

    Code:
    Sub Test1()
    
        ActiveSheet.Range("a4").Offset(37, 0).Select
    
    End Sub
    
    
    Sub test2()
        Dim rngNext As Range
        
        Set rngNext = ActiveSheet.Range("a4").Offset(37, 0)
        MsgBox rngNext.AddressLocal
        
    End Sub
    cheers,
    ray

    If your query has been Solved, please mark it as such in the top menu via Mark Thread Resolved under Thread Tools

    Was a post helpful? Then you might care to rate it by clicking Rate This Post on the lower left hand side of it

  3. #3
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Filtering and then copying

    After using AutoFilter, try this:
    Code:
        Sheet1.AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Select
        Debug.Print ActiveCell.Row
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  4. #4
    Addicted Member
    Join Date
    Mar 2005
    Posts
    222

    Re: Filtering and then copying

    Hi Jeff,

    If your filtering code happens to be scrolling some of the results out of view, then this command should scroll them back into view.
    Code:
    ActiveWindow.ScrollRow = 5
    Last edited by SQLADOman; Jun 15th, 2010 at 08:22 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width