ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Set range with Find method (https://www.excelbanter.com/excel-discussion-misc-queries/212348-set-range-find-method.html)

jlclyde

Set range with Find method
 
Dim Env As Worksheet
Env.Activate
Dim Con1 As Range
Set Con1 = Env.Range("A1:A65").Find("1stConverting Run",
LookIn:=xlValues)
I am trying to set the cell that is found as the range Con1. What is
wrong with this?

Thanks,
Jay

Gary''s Student

Set range with Find method
 
The problem is with Env.

I don't see where it is Set. This does work:

Sub fhskdf()
Dim Con1 As Range
Set Con1 = Range("A1:A65").Find("1stConverting Run", LookIn:=xlValues)
MsgBox (Con1.Address)
End Sub

--
Gary''s Student - gsnu200817


"jlclyde" wrote:

Dim Env As Worksheet
Env.Activate
Dim Con1 As Range
Set Con1 = Env.Range("A1:A65").Find("1stConverting Run",
LookIn:=xlValues)
I am trying to set the cell that is found as the range Con1. What is
wrong with this?

Thanks,
Jay



All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com