Reputation: 979
I am writing a code for automatically reading in data from a closed workbook.
I am having some problems with the formating. The problem is when I am reading in some text in a row (each text is followed by six empty cells), and I am trying to merge the following blank cells.
For Row = 1 To NumRows
For Column = 3 To LastColumn
Range(Cells(Row, Column).Address, Cells(Row + 1, Column + 6).Address).Merge
...
This merges everything into one cell. If I have 10 cells containing text, I want ten merged cells.
Any ideas?
Upvotes: 1
Views: 1126
Reputation: 26591
It does merge your whole cells because you parse 1 by 1. Meaningly, what your program do is:
A1
A1:A6
are mergedA2
A2
to A6
!What you can do:
step
option on your for loops - see here for more informationcontinue
statement in your for loopRegards,
Upvotes: 1