VBA Loop - Can you make the first and last loop different from the others?
Posted on 2015-01-29
I have a loop in my vba code that moves data from an Access database into an Excel spreadsheet.
Is it possible to have the first and last times through the loop format the cells differently than the rest of the times?
The code inserts a list of items into an Excel spreadsheet. When the first item is entered, I want it to say "Meetings" before it ("Meeting" & vbCrLf & Item). When the code loops back, I don't want it to say "Meeting." I just want the item entered.
Then, when the last item is entered, I want to set the border weight on the bottom of the cell to xlMedium.
I am not sure where to start with this, so any direction given will be greatly appreciated (as always)!