View Single Post
 
Old 02-20-2020, 08:43 PM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Windows XP Office 2007
Competent Performer
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default

Your code reads the first row of the table outside the loop then starts the loop with the second data line. This is probably the best solution. My only reluctance is that means the code to read the data is in the macro in two places, which always opens up the possibility of them not being identical. I always try to never duplicate code if I can help it.

The other solution that I have used is to check inside the loop if it's the first iteration, but that puts code inside the loop that is unnecessary after the first iteration, which I also don't like.

What if I change the datatype of the variable to Variant? Is there a value, like Null, that I can initialize it to that can never be a match for anything that could ever be in a Word table?
Reply With Quote