Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Is it possible not to specify a cell reference when data is filter

Define a range of the filtered cells, something like this:

Dim entirerng As Range, filtrng As Range, filtcell As Range
'...
Columns("A").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="TRUE"
Set entirerng = ActiveSheet.AutoFilter.Range.Columns(1)
Set entirerng = entirerng.Offset(1, 0).Resize(entirerng.Rows.Count - 1)
On Error Resume Next
Set filtrng = entirerng.SpecialCells(xlVisible)
On Error GoTo 0

For Each filtcell In filtrng
' your code here! refer to the filtered cell as filtcell, e.g.
filtcell.Value = "newvalue"

Next filtcell

(Courtesy of Bob Philips!)

Regards,
Stefi

€žSarah (OGI)€ť ezt Ă*rta:

I'm trying to create a macro that will filter a specific column on one of my
worksheets and will perform a calculation on each row of the resulting list
of cells. However, the code that's created references cell AA71 (the first
cell listed when the code was created) but this might change everytime the
source data is updated, i.e. I've repeated the process now and the fist cell
is AA2.

Is there any way of not specifying a particular cell reference? (The first
row required will always be the first row under the row header.)

Many thanks in advance.

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
reference cell from advanced filter Nathan Excel Worksheet Functions 3 March 26th 10 02:02 AM
Apply filter and cell reference umpire_43 Excel Programming 1 June 11th 09 02:51 AM
Pivot Table - filter by a cell reference Jeff S[_2_] Excel Programming 0 February 13th 07 11:11 PM
Filter Macro with Cell reference chris100[_70_] Excel Programming 2 August 14th 06 10:51 AM
Filter and show data based on a reference cell Stephen Hancock Excel Worksheet Functions 3 June 30th 06 07:53 PM


All times are GMT +1. The time now is 06:26 PM.

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"