Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofiltered cell value (VBA)

I would like to get cell's value [like using i.e cells(x,y).value]
from the rows which are visible after autofiltering. How to get only
these visible values?
For example:
If I have 10 rows but only 2 rows matching the autofilter criteria.

For i=1 to 10
Msgbox Range.Cells(i, 1).value
Next i

This code gives me all the values - it don't considering to autofiler
results...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Autofiltered cell value (VBA)

Hi Jaro,

One way:

Sub Tester02()
Dim cell As Range
Dim Rng As Range
Dim x As Long
Const y As Long = 1

Set Rng = ActiveSheet.AutoFilter.Range
Set Rng = Rng.Offset(1).Resize(Rng.Rows.Count - 1)
Set Rng = Rng.Columns(y).SpecialCells(xlCellTypeVisible)

For Each cell In Rng
x = x + 1
If x 10 Then Exit For
MsgBox cell.Value
Next cell

End Sub


---
Regards,
Norman



"Jaro" wrote in message
om...
I would like to get cell's value [like using i.e cells(x,y).value]
from the rows which are visible after autofiltering. How to get only
these visible values?
For example:
If I have 10 rows but only 2 rows matching the autofilter criteria.

For i=1 to 10
Msgbox Range.Cells(i, 1).value
Next i

This code gives me all the values - it don't considering to autofiler
results...



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add up cells that are autofiltered? PayPaul Excel Worksheet Functions 4 November 12th 07 06:49 PM
autofiltered file jimmj1210 Excel Discussion (Misc queries) 1 February 14th 06 03:45 PM
Selecting autofiltered cells Annita Excel Programming 4 August 13th 04 06:22 PM
Filling An Autofiltered List Neil Excel Programming 1 August 3rd 04 01:46 AM
Filling An Autofiltered List Neil Excel Programming 0 August 2nd 04 03:05 PM


All times are GMT +1. The time now is 05:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"