Questions on this blog:

Add-in Express™ Support Service
That's what is more important than anything else

Questions on this blog:
How to find the last used cell (row or column) in Excel 
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Hi, Andrei

In the AddinModule.vb for the blog sample, there is this piece of code:


Private Sub LastEmptyButFormattedCell()

Do
      'Do we need to exit the DO...LOOP?
       If exitLoop Then Exit Do

       'Peform a search
       found = .Find("", _
            ExcelApp.ActiveCell, _
            Excel.XlFindLookIn.xlValues, _
            Excel.XlLookAt.xlPart, _
            Excel.XlSearchOrder.xlByRows, _
            Excel.XlSearchDirection.xlPrevious, _
            MatchCase:=False, _
            SearchFormat:=True)



Why do we put a dot in front of Find?

found = .Find("", _


Thanks
Leon
Posted 26 Feb, 2019 09:42:31 Top
Andrei Smolin


Add-in Express team


Posts: 16306
Joined: 2006-05-11
Hello Leon,

This is part of syntax: there's a With construct somewhere above that code. I've found it: With sheet.Range("Sample"). In this context, ".Find(something)" means sheet.Range("Sample").Find(something).

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Feb, 2019 01:49:04 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Andrei,

Yes, I forgot the With clause!

Thanks a lot.
Leon
Posted 27 Feb, 2019 04:49:51 Top
Andrei Smolin


Add-in Express team


Posts: 16306
Joined: 2006-05-11
No problem.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Feb, 2019 05:03:42 Top