I am trying to name a range based on a .Find then define that range as my variable so I can enter the variable into a different function. When I run the code I get a type mismatch error.
Sub Faked()
Dim r As Range
Cells.Find(What:="EE status", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlDown)).Name = "Win"
Set r = ("Win")
End Sub
Because Scott says so. Try Set r = range("Win")
To test if r picked up the range correctly, one could do
for each c in r
debug.print c
next
Edit: or if you're cool like Dirk,
Set r = [Win]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With