Hi guys, I've been trying to make a loop activate the cells (one at a time) that fulfils a condition but it gets stuck only on the first cell that fulfils the condition and if you run the macro again, it stays there!
Thank you!
Hi guys, I've been trying to make a loop activate the cells (one at a time) that fulfils a condition but it gets stuck only on the first cell that fulfils the condition and if you run the macro again, it stays there!
Thank you!
Last edited by realbestpete; 05-25-2022 at 06:12 PM.
Should work like this:
WBDPlease Login or Register to view this content.
Office 365 on Windows 11, looking for ✶ rep!
Hi and thank you very much for your reply. There are a couple of things I have to mention;
On the sample file I uploaded here, to play the macro from a cell outside the named range works well. However, in the actual spreadsheet I'm going to use at work, it presents two problems;
1. When I play the macro from a cell that is outside the named range (which I require in the actual spreadsheet), it starts finding ocurrences from the second ocurrence, not from the first one.
2. When I play the macro from a different sheet (which I also require in the actual spreadsheet), it presents an error; Method 'Intersect' of object '_Application' failed. This also happens with the sample file I uploaded here.
3. It would help me a lot to have the option to not only start finding ocurrences from top to bottom but also from bottom to top.
I would appreciate it if you could give me a hand on that!
Last edited by realbestpete; 05-24-2022 at 02:47 PM.
Hi there,
You can activate the sheet before searching the cells:
WBDPlease Login or Register to view this content.
Hi, thanks for the reply. That solved the problem playing the macro from a different sheet. However, I still get the second ocurrence of the "OK" Status rather than the first one, when the active cell is not within the "Status" named range. I have uploaded another sample to show this situation!
Thank you!
Last edited by realbestpete; 05-24-2022 at 04:33 PM.
OK. That only happens if the first cell in the range is "OK". You could change the range to include the header or adjust the code like this:
WBDPlease Login or Register to view this content.
Thank you very much! It worked!
It's just that I thought that once the 'find "OK"' macro was working, I could easily replicate that to make it do the same for "Current" values and to add two conditions, since I had achieved that with a For Each... Next Statement (except of course that it didn't show me the next occurrence and that is why I asked for help here) so I'm going to ask you to please help me on that too:
1. Find the values only if the corresponding "Status1" column has the value of "FALSE".
2. Find not only "OK" values but also "Current".
3. If the value found is "OK", activate the corresponding cell on the "Status1" column and if the value found is "Current", then activate that cell, which is in the "Status" column.
I have been trying all these hours but couldn't do it! Thank you so much for your help and I hope with this, I can finally close this thread!
If you're original question is answered, please create a new thread for a new question - that way you'll attract more viewers to your post.
WBD
Ok WBD, thank you for your kind help!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks