ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Object not set (https://www.excelbanter.com/excel-programming/441147-re-object-not-set.html)

Barb Reinhardt

Object not set
 
IIRC, when you're looking for dates, you need to search for them in the same
format they are displayed in the workbook.
--
HTH,

Barb Reinhardt



"David" wrote:

Hi Group,

Hope all are having a good day. The code has this object not set:

For i = 1 To 4
Selection.Find(What:=" & (Date1) & ", After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Close1 = ActiveCell.Offset(0, 4).Value
Range(ReturnAddress).Value = Close1
Next

I have above:
Dim Date1 as Date

But when I try and set it fails with:
Set Date1 = ActiveCell.Offset(-2, 0).Value

So I changed it and did not set it:
Date1 = ActiveCell.Offset(-2, 0).Value

I am not sure what I am missing at this point, since I treid to Set it and
then tried not setting it.

Thanks,
--
David



All times are GMT +1. The time now is 03:25 AM.

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