Looking ior the commnds for several things....

  • Thread starter Thread starter Phillips
  • Start date Start date
P

Phillips

I would like to know how to move the:
First record (disregarding filter settings ]) would this be some thing like
activecell(-row(),0)

First VISIBLE record

Last record (disregarding filter settings)
Last VISIBLE record

I want these setting for my nav bar.

Would I hen ge something like
set rMarker to firstrow() ' or what ever command that you tell me...)
activecell(rMarker,0)

The next/prev I have hammered out and it works fine

How do I use the SCROLL bar to move to a given record, and how do I update
the scrollbar?
I have the SCROLLBAR working for the next/prev. If it filter is in place amd
I do NOT what to see hidde, then I update the varible plus or minus 1 for
each time I press the up/down (and test for <1 and greater than record
count) and if filter, then ONLY when the keys are pressed AND record is not
hidden.
I need to find out what the current record postion I am on currently



How do I get the record or record when aq FILTER is set?
I know there is a command that will give me the count of visible rows, how
do I do this?

Thanks

I know these are basic questions, but I have not been able to find the
answers in any of my books, or the web (I KNOW it is there...)
 
Assume your data is in a named range Database

Sub FirstRecord()
Range("Database").Rows(2).Select
End Sub

Sub LastRecord()
Dim rng As Range
Set rng = Range("Database")
rng.Rows(rng.Rows.Count).Select
End Sub

Sub FirstVisibleRecord()
Dim rng As Range, rng1 As Range
Dim rng2 As Range
Set rng = Range("Database")
Set rng1 = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
On Error Resume Next
Set rng2 = rng1.SpecialCells(xlVisible)
On Error GoTo 0
If Not rng2 Is Nothing Then
rng2.Areas(1).Rows(1).Select
End If
End Sub

Sub LastVisibleRecord()
Dim rng As Range, rng1 As Range
Dim rng2 As Range, rng3 As Range
Set rng = Range("Database")
Set rng1 = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
On Error Resume Next
Set rng2 = rng1.SpecialCells(xlVisible)
On Error GoTo 0
If Not rng2 Is Nothing Then
Set rng3 = rng2.Areas(rng2.Areas.Count)
rng3.Rows(rng3.Rows.Count).Select
End If
End Sub
 
Back
Top