Hello everyone,
Imagine if I have more than one row with the current date. My macro works for one row but I want it to work for multiple rows, how can I fix it, here is the code.
![]()
Please Login or Register to view this content.
Hello everyone,
Imagine if I have more than one row with the current date. My macro works for one row but I want it to work for multiple rows, how can I fix it, here is the code.
![]()
Please Login or Register to view this content.
Ok, first things first, get out of the habit of selecting and activating. Reference objects directly. Besides issues arising from not selecting the right object, it takes less code and executes quicker.
This will result in each new line found in the Risk sheet being inserted into row 2 of the ErrorLog and each previously found line being shifted down to make way for it.![]()
Please Login or Register to view this content.
You could also write it so that each new line gets added to the NEXT line of the ErrorLog:
Hope this helps.![]()
Please Login or Register to view this content.
![]()
Last edited by kadeo; 03-18-2015 at 10:51 AM.
The technical answer to your question is; after the first iteration of your loop the active worksheet is changed and the code within the loop incorrecly functions on the active workbook/worksheet.
Thank you for your reply, it looks brilliant. I'm getting an error though, here is the code:
It highlights Filename and says![]()
Please Login or Register to view this content.
Compile error:
Expected: end of statement
Any ideas?
ok, Replace this line:
with this line:![]()
Please Login or Register to view this content.
And see if that works.![]()
Please Login or Register to view this content.
This works
Thank you for alll your help![]()
Please Login or Register to view this content.
![]()
Cool, Glad I could help. Mark your thread as solved in the thread options. Cheers Lewis.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks