0

I have two PC's with the same worksheet. My code can find the expected date in one of the computers but not in the other one

I tried to change date format on the PC that wasn't working and this solved my problem, but I need a code that runs always, not depending on Windows date format

Workbook2.Activate
Sheets("Sheet1").Select
firstYear = Year(Cells(376, 2))
firstMonth = Month(Cells(376, 2))
firstDate = DateSerial(firstYear, firstMonth, 1)

Workbook1.Activate
Sheets("Sheet1").Select

Set oldforecast = Range("A9:A296").Find(firstDate)

The last line should find the date in Workbook1.xlsm for every computer that runs this code, despite it's date format.

Teamothy
  • 2,000
  • 3
  • 16
  • 26

0 Answers0