Thread: find location
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim G Jim G is offline
external usenet poster
 
Posts: 132
Default find location

I'm trying to set the current selection to an address on a row that contain
dates equal to the end of each monht and matches the current date on a data
page (month ends muct match). The following code returns a type mismatch
error. Can any one help

Sub FindCurMonth()

Dim CurLocation As Range

Dim curDate As Range

Set curDate = Range("B3")


Set CurLocation = Rows(13).Find(What:=curDate.Value, _
After:=Cells(1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

Dim rng As Range
Set rng = Range(CurLocation.Address)
Debug.Print (rng)

If Not CurLocation Is Nothing Then
Address = CurLocation.Address
CurLocation.Select
Else
MsgBox "Not found"
End If
End Sub


--
Jim