Also, you need to be careful with your variable declarations:
In VBA, this line of code will declare FileNum and i as Variants, and iRow as an Integer.
To declare all three as Integers, you should use either of these:
Also, in VBA, an Integer is 16-bit and can hold whole numbers from -32,768 to 32,767. The number of rows in an Excel worksheet can exceed 32,767, which means that the code could be prone to an overflow error. Whenever you're using variables which reflect row numbers, use Long data types.
Bookmarks