Hello again..
I was posting this just as you replied Yasser., so I will post it first then look again at your last reply…
I took a look on some other Excel versions and different computers, operating systems etc…
(
https://excelfox.com/forum/showthread.p ... #post15501
https://excelfox.com/forum/showthread.p ... #post15502
https://excelfox.com/forum/showthread.p ... #post15503 )
2003 ( .xls saved file version )
Very consistently I get
16764057 for the interior color of cell E17
( So your macro, Yasser, won’t work, because it fails to find
15261367 )
2007
.xlsb original file
Occasionally your .xlsb file will not open unless I let Excel do a recovery/ repair that it offers. When this happens there is no interior color shown anywhere so all interior colors come out at
16777215
More often your
.xlsb original file does open OK. Then the interior color of cell E17 is seen as
15261110
( So your macro won’t work, because it fails to find
15261367 )
2007
.xls saved file version
I never have any problem opening this file version in any Excel 2007.
The interior color of cell E17 is seen as
15261110
( So your macro won’t work, because it fails to find
15261367 )
2010
.xlsb original file
**Occasionally your .xlsb file will not open unless I let Excel do a recovery/ repair that it offers. When this happens there is no interior color shown anywhere so all interior colors come out at
16777215
More often your
.xlsb original file does open OK. Then the interior color of cell E17 is seen as
15261367
So for me, so far, your macro always works in Excel 2010 if the file opens OK, ( which it mostly does, but not always**).
2010
.xls saved file version
So far this file opens in all my Excel 2010, and sees cell E17 interior color as
16777215, so your macro always works
_.______
So , it looks initially as you should be looking for any one of these three interior colors:
16777215 Or 15261110 Or 16764057
I would probably go along with something like rory said, - what she said about not using
.Find things unless you are 100% sure of finding them.
Maybe better still forget all about
.FindFormat and
.Find, and just write a simple macro that checks cells for either of those interior colors.
( The only advantage of using
.Find that I have ever experienced is that it can be very efficient/ fast.
Unless you are looking for super performance I would forget about
.Find stuff and keep it simple, such as a simple
For Each cel type loop checking the interior color )
Alan
_.______
P.S.
_1 ( Note that result of the interior color I get for the
.xls file corresponds to that which I get for a working .xlsb file in that Excel version. - I find that a bit strange. - Even though it’s a
.xls file, it seems to have information to tell it to give different values of interior color for cell E17 in the different Excel versions. Weird )
_2 ( I only just now can get on 2003 2007 and 2010. - I will make a note to check on a 2013 and 365 ( insider fast ) that I will be on next week, but I expect they will all work after seeing/
.Finding the
15261367 – If I get any different strange results I will write back ).
_3 If I get any different results for the interior color on any versions I will update here and at those links..
_4
rory wrote: ↑07 Apr 2021, 08:53
... arguments that you don't specify for Find will retain their last used values (either in code or in the UI), which can also affect whether your find works....
Interesting, I didn’t know that. I may need to re think some old codings of mine now.. :(
So it’s another vote for being more explicit and including all arguments, - and better still, used named ones as well just to make it really worthwhile and pretty. :)
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also