J
Jim Youlong
Hi.
I am trying to do a find in a range. Essentially, I want to find the
value of a cell on one page in a specific range on a second page. When
I incorporate a Range object (i.e. Rng) in to the code and I start
getting errors. Any assistance someone might give would be greatly
appreciated.
Here's a simplified version of the code.
Sub MainPageSearchRange()
Dim SearchTarget As String
Dim RngTop, RngBot As Integer
Dim SlctCll As String
SearchTarget = ActiveWindow.Selection.Cells.Value
Worksheets(1).Activate
Set InRng = ActiveCell
RngRow = InRng.Row
'range demarcated by spaces in a specific column
RngBot = Range("I" & RngRow).End(xlDown).Row
RngTop = Range("I" & RngRow).End(xlUp).Row
Rng = Range("G" & RngTop, "G" & RngBot)
Rng.Find(What:=SearchTarget, LookAt:= _
xlPart, SearchDirection:=xlNext, MatchCase:=False).Execute
ActiveCell.Select
End Sub
Thanks
Greg
I am trying to do a find in a range. Essentially, I want to find the
value of a cell on one page in a specific range on a second page. When
I incorporate a Range object (i.e. Rng) in to the code and I start
getting errors. Any assistance someone might give would be greatly
appreciated.
Here's a simplified version of the code.
Sub MainPageSearchRange()
Dim SearchTarget As String
Dim RngTop, RngBot As Integer
Dim SlctCll As String
SearchTarget = ActiveWindow.Selection.Cells.Value
Worksheets(1).Activate
Set InRng = ActiveCell
RngRow = InRng.Row
'range demarcated by spaces in a specific column
RngBot = Range("I" & RngRow).End(xlDown).Row
RngTop = Range("I" & RngRow).End(xlUp).Row
Rng = Range("G" & RngTop, "G" & RngBot)
Rng.Find(What:=SearchTarget, LookAt:= _
xlPart, SearchDirection:=xlNext, MatchCase:=False).Execute
ActiveCell.Select
End Sub
Thanks
Greg