Category Archives: VBA Excel If Statement

How To Use Excel VBA To Loop Through A Range And Copy Conditionally

In this post, we will loop a list of bank account transactions, and copy them programmatically to another sheet based on their date.

Here is an image of the sheet:

In the account ledger, we are going to loop the rows in the “Full Bank Statement” sheet, and extract only the rows that fall within the dates shown in “M2” and “N2”.

If the row data does fall within those date parameters, we will copy and paste the row data into the “July” sheet.

Here is the code:

After all the processing is complete, your “July” sheet should look like this:

Watch how it’s done:

Let me know if you have any questions.

****************************************************

Facebooktwittergoogle_plusredditpinterestlinkedinmail
READ MORE