Forum Discussion
Am puzzled why did the Msgbox popped up despite conditions being met
- Jun 19, 2022
In the attached file you can click the button in cell E3 to start the macro. Basically i changed line 25 of the code because it was a comment.
hrh_dash , try following
1) First of all, it is a good practice to indent the code to check the if blocks. In the code shared by you one End If is missing, but i believe you just missed to put it in your post.
2) Are you sure all conditions are being met? Have you tried debugging by pressing F8 and checking step by step execution? (or e.g. by putting a suitable debug.print "i came here" sort of statement in the copy-paste block?). Or more simply, did the copy-paste actually execute?
3) You are not setting the SearchFormat parameter of Find method. Try writing below statement before the Set rngfind4 ... statement
Application.FindFormat.Clear