Can ANYONE tell me why this code does not work ? I get an error 13, type mismatch errorcode on the For i code line:
Comments: COL L is a date col. Just loop between any two date values anywhere down the COL from two userform textboxes and initially use MsgBox to identify each value found as the code above should do (Will substitude more complicated code in place of MsgBox if someone can get this to work for me.
Thanks, CR
Code:
Private Sub Runreport_Click()
Dim Searchval, Sdate, Edate As Date, myrange, finddesval As Range, ws, wx As Worksheet
Set ws = Worksheets("BILLS")
Set myrange = ws.Range("L2:L777")
myrange.Select
Searchval = Aoe.TextBox1.Value
Sdate = Aoe.TextBox1.Value
Edate = Aoe.TextBox2.Value
Set finddesval = ws.Cells.Find(What:=Searchval After:=[l1], LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
MsgBox ("The value of finddesval is" & finddesval)
For i = Sdate To Edate
MsgBox ("This value of i is" & i)
Next i
End Sub
Comments: COL L is a date col. Just loop between any two date values anywhere down the COL from two userform textboxes and initially use MsgBox to identify each value found as the code above should do (Will substitude more complicated code in place of MsgBox if someone can get this to work for me.
Thanks, CR