Considering all rows even if hidden by autofilters

aaw23

New Member
Joined
Mar 25, 2021
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
Hi

The below is part of a function that all works fine, the workbook with the function is performing a lookup to another.
The problem I'm trying to solve is: the workbook where data is being pulled from, where there are multiple sheets that are named containing the text "BM" are always in some state of having autofilters applied. This function only considers the rows that are visible on the sheets BM. What I am seeking to add into the below is the code that would consider all rows on the sheets "BM", not just the visible ones.

So to have dBookSuth.Worksheets("BM" & i) be considered with all autofilters cleared.

And I just can't seem to crack it. Appreciate any assistance.



Set dBookSuth = Workbooks.Open(dFileNameSuth, , True)

Dim lastRow As Integer, dealList As Range, dcell As Range, frange As Range
lastRow = iSheet.Cells(100000, 12).End(XlDirection.xlUp).Row
If lastRow >= 7 Then
Set dealList = iSheet.Range("L7:L" & lastRow)
For Each dcell In dealList.Cells
If dcell.Value <> "" Then
Set frange = Nothing
For i = 1 To 6
Set dSheetSuth = dBookSuth.Worksheets("BM" & i)
If Not dSheetSuth Is Nothing Then
Set frange = FindValueInRange(dSheetSuth.Range("G:G"), dcell.Value)
If Not frange Is Nothing Then
GoTo processRow
End If
End If
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
So to have dBookSuth.Worksheets("BM" & i) be considered with all autofilters cleared.
Add these lines:

Rich (BB code):
  If Not dSheetSuth Is Nothing Then
    If dSheetSuth.AutoFilterMode Then dSheetSuth.AutoFilterMode = False
    If dSheetSuth.FilterMode Then dSheetSuth.ShowAllData
    dSheetSuth.Cells.EntireRow.Hidden = False
    Set frange = FindValueInRange(dSheetSuth.Range("G:G"), dcell.Value)
 
Upvote 0
That worked well, thanks very much for the quick reply and really helping out
 
Upvote 0
Im glad to help you. Thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,554
Messages
6,125,487
Members
449,233
Latest member
Deardevil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top