Concatenate a range of cells in a range of cells

M_F

New Member
Joined
Feb 8, 2021
Messages
2
Hello!

Thank you in advance for your help.

I´m really new at Excel VBA and I'm trying to code something too complex for my newbie skills...


Input: I have column A with some lines of text like this:


Separator string <------------------
line1
<blank cell>
line2
<blank cell>
<blank cell>
line3
line4
<blank cell>
Separator string <------------------
<blank cell>
line 5
line 6
<blank cell>
Separator string <------------------
line 7
<blank cell>
<blank cell>
Separator string <------------------
line 8
.......


I would like to have an Output in column B that concatenates in a cell each set of cells within a Separator string:

Cell B1 :
line1
<blank cell>
line2
<blank cell>
<blank cell>
line3
line4
<blank cell>

Cell B2:
<blank cell>
line 5
line 6
<blank cell>

Cell B3:
line 7
<blank cell>
<blank cell>

Cell B4:
line 8
.......


Could you help me?
Thank you very much
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Is this what you would want as a result?

line1, , line2, , ,line3, line4,
,line5, line6,
line7, ,
line8
 
Upvote 0
Thank you for your help.

The lines are pasted from a text file. They have newline in the end. I would like that they maintain the line breaks (some "lines" have some paragraphs on them).
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,811
Members
449,339
Latest member
Cap N

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top