+ Reply to Thread
Results 1 to 7 of 7

View next visible row after filter has been applied

Hybrid View

  1. #1
    Registered User
    Join Date
    11-25-2012
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2003
    Posts
    55

    View next visible row after filter has been applied

    Really stuck would appreciate some help on this....

    I have attached a test file, what I cant get to work is the navigation buttons (First, Last, Next and Previous) after the filter has been applied.

    I had it working before introducing the filter, but now have got myself so confused.....
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: View next visible row after filter has been applied

    Hi,

    Can we rewind and would you explain what you are trying to achieve with the workbook. By that I don't mean tell us how your existing design and code is meant to work, but tell us the overall aim. i.e. How do you use/drive the system and what end result is required after you've done whatever it is you want to do. There may well be a more efficient way of achieving your goal.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-25-2012
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: View next visible row after filter has been applied

    Thanks for your reply.

    I have a 28 column spreadsheet with a couple of forms, one is a search form enabling a search function one all columns. Then there is this one the view form.

    The id number in the colum A brings the information to the form, and that number is displayed in textbox1, the next button then takes that number adds 1 and then the form displays that record - all good until you filter (search form) - so what I need is a function that will take the first visible number in column A and then when next button is pressed moves the the next visible row bringing the number Crome column A over to text box 1 which then displays the record........

    Previous, first and end need to perform the same as in bring the number from column A.

    Hope this makes sense, have got my self in knots over this,

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: View next visible row after filter has been applied

    Hi,

    Does the attached simplified code help
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-25-2012
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: View next visible row after filter has been applied

    Yes Richard it does make it clearer... thanks


    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Does the attached simplified code help

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: View next visible row after filter has been applied

    Hi Wales MB,
    try so
    Option Explicit
    Dim x(), CurRec&
    
    Private Sub UserForm_Initialize()
    Application.ScreenUpdating = False
    With Sheets(1)
        .Range("A1").CurrentRegion.Copy .Range("A200")
        With .Range("A200").CurrentRegion
            x = .Value
            .Clear
        End With
    End With
    Application.ScreenUpdating = True
    Label60 = UBound(x) - 1 & " Records found": TextBox2.SetFocus
    CurRec = 2: Call ViewRecord
    End Sub
    see also attachment
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-25-2012
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: View next visible row after filter has been applied

    Nilem - Thanks for that.

    I thought the following be the best way to cover any size data list,

    .Range("A1").CurrentRegion.Copy .Range("A1048576")
            With .Range("A1048576").CurrentRegion
    What would be the correct way to make sure it covers a data list of anysize......... or does the 200 refer to somthing else?

    Private Sub UserForm_Initialize()
        Application.ScreenUpdating = False
        With Sheets(1)
            .Range("A1").CurrentRegion.Copy .Range("A200")
            With .Range("A200").CurrentRegion
            x = .Value
            .Clear
            End With
        End With
        Application.ScreenUpdating = True
        Label60 = UBound(x) - 1 & " Records found": TextBox2.SetFocus
        CurRec = 2: Call ViewRecord
    End Sub
    
    Sub ViewRecord()
    Dim j&
        For j = 1 To UBound(x, 2)
            Me("TextBox" & j).Value = x(CurRec, j)
        Next j
    End Sub
    Confusion = Not 100% sure I understand how this works - I think it looks at the range - copies to computer memory (CurRec)

    Then ViewRecord brings it back out........????
    Last edited by Wales MB; 11-18-2015 at 10:44 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Trying to Setup a Spreadsheet With an Applied Advanced Filter/Custom View
    By Bob Toddler in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-27-2015, 11:09 AM
  2. [SOLVED] Sum visible cells two by two when automatic filter is applied
    By Lalla in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-18-2014, 07:45 AM
  3. Replies: 0
    Last Post: 02-28-2014, 04:49 PM
  4. Replies: 7
    Last Post: 11-20-2013, 01:50 PM
  5. [SOLVED] Objects are visible in Design View but not in Form View
    By Lloyd Blankfein in forum Access Tables & Databases
    Replies: 3
    Last Post: 06-14-2013, 09:57 AM
  6. Replies: 0
    Last Post: 04-07-2006, 06:25 PM
  7. some view settings could not be applied
    By AlanMagpie in forum Excel General
    Replies: 0
    Last Post: 10-14-2005, 10: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