I used a recorded macro to try and learn how to use the Find command in VBA. Everything works fine if I want to activate the cell containing the information, like this:
Unfortunately, when I try to assign the address to a variable, it never assigns anything... such as:
Any idea what I'm doing wrong?
Code:
Dim fullName as String
Selection.Find(What:=fullName, After:=ActiveCell, LookIn:= _
xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext _
, MatchCase:=False, SearchFormat:=False).Activate
Unfortunately, when I try to assign the address to a variable, it never assigns anything... such as:
Code:
Dim rng as Range, fullName as String
rng = Selection.Find(What:=fullName, After:=ActiveCell, LookIn:= _
xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext _
, MatchCase:=False, SearchFormat:=False).Address
Any idea what I'm doing wrong?