![]() |
trouble with cell choice
Tom,
Thank You very much for another assistance. Yours sincerely Mark -----Original Message----- Public Function GetRange(lIdex as Long, MaxRow as Long) as Range Dim rng As Range, rng1 As Range Dim llIndex As Long Dim Maxrow as Long With Worksheets("Sheet2") If .AutoFilterMode Then Set rng = .AutoFilter.Range Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1, 1) On Error Resume Next Set rng1 = rng.SpecialCells(xlVisible) On Error GoTo 0 End If End With If Not rng1 Is Nothing Then MaxRow = rng1.count llIndex = 0 For Each cell In rng1 llIndex = llIndex + 1 If llIndex = lIdex Then set GetRange = Cell Exit For End If Next Else MaxRow = 0 set GetRange = Nothing End If End Function Call this function with the number of the visible row you want in the filter. Dim MaxVisible as Long set myRow = GetRange(1,MaxVisible).EntireRow msgbox "1st record of " & MaxVisible & " records is at absolute row: " & myRow.row as an example would set myRow to the first visible row (below the header row) and MaxVisible would tell you the number of visible rows If myRow is nothing, then Check MaxVisible - you might have requested a row that is more than the max visible. -- Regards, Tom Ogilvy "Mark" wrote in message ... Hi, I have chosen criterion in my autofilter and i'd like select some cell in first row with data selection. Any offset does't work. Can anyone assist ? Best regards Mark . |
All times are GMT +1. The time now is 03:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com