Find troubles

  • Thread starter Thread starter David
  • Start date Start date
D

David

I want to select a student name from AE3 Data Validation dropdown and class
from AF3 Data Validation dropdown and wind up activating the class under
the student name.

This finds the student name, but stops there:
Sub FindClass()
Dim ThisClass, FoundClass As Range
Columns("A:A").Find(Range("AE3")).Activate
ThisClass = Range("AF3").Value
Set FoundClass = Selection.Find(What:=ThisClass, _
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
End Sub
 
David wrote
I want to select a student name from AE3 Data Validation dropdown and
class from AF3 Data Validation dropdown and wind up activating the
class under the student name.

This finds the student name, but stops there:
Sub FindClass()
Dim ThisClass, FoundClass As Range
Columns("A:A").Find(Range("AE3")).Activate
ThisClass = Range("AF3").Value
Set FoundClass = Selection.Find(What:=ThisClass, _
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
End Sub

Fumbled around and came up with this:
Sub FindClass()
Dim ThisClass As String, Rng As Range
Columns("A:A").Find(Range("AE3")).Activate
ThisClass = Range("AF3").Value
Set Rng = Range(ActiveCell.Address, Range(ActiveCell.Address).End(xlDown))
Rng.Find(ThisClass).Select
End Sub

Works, anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top