get the data from a filtered table.

EricKr

New Member
Joined
Nov 18, 2014
Messages
3
With the folowwing code, I try to walk trough the filterd rows of a table:

Sub GetConfigDataLists()
Dim xRange As Range
Set xRange = Sheets("config").ListObjects("config_table").DataBodyRange
xRange.AutoFilter 1, "Lists"
xRange.Select
For Each Row In xRange
'Try to read in a variable
MsgBox (row)

Next Row

End Sub

The Table is a simple table with the name config_tabel
Parameter Field Value
Lists RisksTop5Risks
Lists Issues Top5Issues
Startup Sheet Progress
Location save c:\temp

<tbody>
</tbody>


When I filterd and run the code, all Fields are displayed in the messagebox...

How can I read the filterd cells : Field and Value...
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You need reset what xRange is or Create a new one.

Code:
Sub GetConfigDataLists()
Dim xRange As Range, FilteredRange As Range
Set xRange = Sheets("config").ListObjects("config_table").DataBodyRange
xRange.AutoFilter 1, "Lists"
Set FilteredRange = Sheets("config").ListObjects("config_table").DataBodyRange.SpecialCells(xlCellTypeVisible)
For Each Row In FilteredRange
'Try to read in a variable
MsgBox (row) 


Next Row


End Sub

You maybe aware but your code states otherwise your for Each is looking at each cell not each row.
 
Last edited:
Upvote 0
You maybe aware but your code states otherwise your for Each is looking at each cell not each row.

Correct and I want to change it to Read the cells of the filtered row, but i don't know how....?
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,614
Members
449,091
Latest member
gaurav_7829

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