select a cell in a filtered row

Status
Not open for further replies.

colinharwood

Active Member
Joined
Jul 27, 2002
Messages
440
Office Version
  1. 365
Platform
  1. Windows
I have the following code to search for a row using the filter option, but cannot work out what to put in the *Range("???? ").Select* line of code.

VBA Code:
Sub FindMember()
   
    Sheets("Members").Select
    Range("A5:AF95").Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$5:$AF$95").AutoFilter Field:=1, Criteria1:=Sheets("PDF Membership Card").Range("X2").Value
   
    *Range("???? ").Select*
   
    ActiveCell.FormulaR1C1 = "=TODAY()"
    ActiveSheet.Range("$A$5:$AF$95").AutoFilter Field:=1
    Selection.AutoFilter
End Sub

I have tried allsorts, but because the label row and the filtered row are selected during the filter process I cannot select the col in the filtered result.
What code do I need to select col 10 in the filtered list.
 
Last edited by a moderator:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
When posting vba code in the forum, please use the available code tags. It makes your code much easier to read/debug & copy. My signature block below has more details. I have added the tags for you this time. 😊

It is rare in vba to need to actually select cells/ranges/worksheets etc to work with them and selecting slows your code.
Also wondering if you really want the formula =TODAY() entered into the relevant cells as tomorrow, those cell will show tomorrow's date, not todays date?

Taking a few guesses about exactly what you are trying to do, try this with a copy of your workbook.

VBA Code:
Sub FindMember()
  With Sheets("Members")
    .AutoFilterMode = False
    With .Range("A5:AF" & .Range("A" & Rows.Count).End(xlUp).Row)
      .AutoFilter Field:=1, Criteria1:=Sheets("PDF Membership Card").Range("X2").Value
      If .Columns(1).SpecialCells(xlVisible).Count > 1 Then
        .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlVisible).Columns(10).Value = Date
      End If
      .AutoFilter
    End With
  End With
End Sub
 
Upvote 0
Solution
This appears to be a duplicate of: Filter using a cell value as the criteria

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.

My suggestion here may answer your question in the linked thread if the heading row matches (or is adjusted) and if the target column is actually Q and not the 10th column as stated here, change the 10 in this code to 17.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,912
Messages
6,175,344
Members
452,638
Latest member
Oluwabukunmi

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