0

I've got a macro-enabled workbook that works just fine in Office365's version of Excel but earlier versions are breaking all over the place. If anyone could provide direction, I would appreciate it! The current issue is with this bit below:

Range("1:1").Select
        Selection.Find(What:="eventdate", After:=ActiveCell, LookIn:=xlFormulas2, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Select
        Range(Selection.Offset(1, 0), Selection.Offset(1048570, 0).End(xlUp)).Select
        Set rng = Selection
        For Each eventdateCell In rng
            eventdateCell.NumberFormat = "@"
            eventdateCell.Value = WorksheetFunction.Text(eventdateCell.Value, "yyyy-mm-dd")
        Next eventdateCell
BigBen
  • 46,229
  • 7
  • 24
  • 40
  • 1
    `xlFormulas`, not `xlFormulas2`. – BigBen Jun 24 '20 at 14:27
  • 1
    Normally you find the last cell using [this approach](https://stackoverflow.com/questions/11169445/error-in-finding-last-used-cell-in-excel-with-vba). That hard-coded `1048570` can be avoided. – BigBen Jun 24 '20 at 14:28
  • 2
    And for more reading: [how to avoid Select](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba). – BigBen Jun 24 '20 at 14:29
  • "breaking all over the place" - specific examples of specific problems are always easier to deal with. What's not working, what error message(s), which line(s) of code? – Tim Williams Jun 24 '20 at 15:25
  • Earlier versions of Excel did not have that many rows. – Tim Williams Jun 24 '20 at 15:27

0 Answers0