Merging multiple cells with content

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,647
Office Version
2010
Platform
Windows
At first I tried to run the macro with just a few numbers in the cells. I now changed the numbers to words and this time I get the following error message:

Can't execute code in break mode.
That means your code did not end, it is still running but only temporarily stopped at a breakpoint. Either click the small square icon in the "ribbon" under the menu bar or, alternately, click the Run menu bar item and then click the Reset item in the dropdown menu that appears to fully halt the program.


The highlighted line in the code is indeed <tbody>[TR]
I am not sure what you are doing, but <tbody.[TR] is not VBA code (looks more like HTML tag information to me)... if you actually have that in your code, delete it as that would not be syntactically correct.


Does this help or should I upload the file?
If doing the above doesn't make the code work correctly, then yes, post the workbook to DropBox and let us see exactly what you have.
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

AVRAHAMROOS

New Member
Joined
Nov 24, 2016
Messages
21
link to file:

lines I try to merge: 2-6

error message: Can't execute code in break mode

highlighted line in the code: <tbody>[TR]
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,647
Office Version
2010
Platform
Windows
I explained how to handle the Break Mode warning in Message #11.

As to your code, I was right... you have HTML tags within it which are not part of the VBA code structure. Here is how your code should look...
VBA Code:
Sub test1()
  Dim C As Variant
  For Each C In Intersect(ActiveSheet.UsedRange, Selection).Columns
    Cells(Selection(1).Row, C.Column) = Join(Application.Transpose(Intersect(Selection, C)))
  Next
  Selection(1).Offset(1).Resize(Selection.Rows.Count - 1).EntireRow.Delete
End Sub
In the future, when you take code from this forum, copy it from the forum message directly... do not click the Reply button and try to copy it from there as it has the HTML tags that tell the forum message how to display the code.
 

Forum statistics

Threads
1,089,267
Messages
5,407,284
Members
403,131
Latest member
Lewas2019

This Week's Hot Topics

Top