Combining text in two merged cells

alexg7828

New Member
Joined
Aug 4, 2017
Messages
18
I have two merged groups of cells, both with multi line text and name as ranges (Range1 and Range2) both can be varying lengths.

I have a form, if a specified check box is ticked i want to copy the text in Range 2 to Range 1 with a line break and then format the Range 2 text to bold red.

I was thinking something like below but cant quite work out wether it should be a copy, concenate or something different ... or impossible.

VBA Code:
If check_DemInfo.Value = True Then
    Range("Range1").Copy
    Range("Temp_1").PasteSpecial xlPasteValues
    Range("Temp_1").PasteSpecial xlPasteFormats
    Range("Range2").Copy
    Range("Temp_2").PasteSpecial xlPasteValues
    Range("Temp_2").PasteSpecial xlPasteFormats
    Range("Range1").Value = Range("Temp_1") & Range("Temp_2")
End If
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,619
Office Version
  1. 2007
Platform
  1. Windows
copy the text in Range 2 to Range 1 with a line break and then format the Range 2 text to bold red.

If you want in red bold the part2 that was added to the cell
Before Something like this:
1590358783336.png


After:
1590358806550.png


Then, try this:

VBA Code:
Sub CopyData()
  Dim n As Long
  With Range("Range1")
    .Font.Bold = False
    n = Len(.Value)
    .Value = .Value & Chr(10) & Range("Range2").Value
    With .Characters(n + 2, Len(Range("Range2").Value)).Font
      .Bold = True
      .Color = vbRed
    End With
  End With
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,127,524
Messages
5,625,313
Members
416,094
Latest member
tjrogers04

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
Top